Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dmtrKovalenko committed Apr 29, 2024
1 parent 48e502e commit b144e3a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ export type ODiffOptions = Partial<{
antialiasing: boolean;
/** If `true` reason: "pixel-diff" output will contain the set of line indexes containing different pixels */
captureDiffLines: boolean;
/** If `true` odiff will use less memory but will be slower with larger images */
reduceRamUsage: boolean;
/** An array of regions to ignore in the diff. */
ignoreRegions: Array<{
x1: number;
Expand Down
4 changes: 2 additions & 2 deletions bin/Main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ type 'output diffResult = { exitCode : int; diff : 'output option }
(* Arguments must remain positional for the cmd parser lib that we use *)
let main img1Path img2Path diffPath threshold outputDiffMask failOnLayoutChange
diffColorHex toEmitStdoutParsableString antialiasing ignoreRegions diffLines
disableMemoryOptimizations =
disableGcOptimizations =
(*
We do not need to actually maintain memory size of the allocated RAM by odiff, so we are
increasing the minor memory size to avoid most of the possible deallocations. For sure it is
not possible be sure that it won't be run in OCaml because we allocate the Stack and Queue
By default set the minor heap size to 256mb on 64bit machine
*)
if not disableMemoryOptimizations then
if not disableGcOptimizations then
Gc.set
{
(Gc.get ()) with
Expand Down
4 changes: 2 additions & 2 deletions bin/ODiffBin.ml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ let diffLines =
"With this flag enabled, output result in case of different images \
will output lines for all the different pixels"

let reduceMemory =
let disableGcOptimizations =
value & flag
& info [ "reduce-ram-usage" ]
~doc:
Expand All @@ -83,7 +83,7 @@ let cmd =
in
( const Main.main $ base $ comp $ diffPath $ threshold $ diffMask
$ failOnLayout $ diffColor $ parsableOutput $ antialiasing $ ignoreRegions
$ diffLines $ reduceMemory,
$ diffLines $ disableGcOptimizations,
Term.info "odiff" ~version:"3.0.0" ~doc:"Find difference between 2 images."
~exits:
(Term.exit_info 0 ~doc:"on image match"
Expand Down
2 changes: 2 additions & 0 deletions bin/node-bindings/odiff.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export type ODiffOptions = Partial<{
antialiasing: boolean;
/** If `true` reason: "pixel-diff" output will contain the set of line indexes containing different pixels */
captureDiffLines: boolean;
/** If `true` odiff will use less memory but will be slower with larger images */
reduceRamUsage: boolean;
/** An array of regions to ignore in the diff. */
ignoreRegions: Array<{
x1: number;
Expand Down
4 changes: 4 additions & 0 deletions bin/node-bindings/odiff.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ function optionsToArgs(options) {
setFlag("output-diff-lines", value);
break;

case "reduceRamUsage":
setFlag("reduceRamUsage", value);
break;

case "ignoreRegions": {
const regions = value
.map(
Expand Down

0 comments on commit b144e3a

Please sign in to comment.