Skip to content

Commit

Permalink
feat: Improve png write/read performance by switching to libspng (#57)
Browse files Browse the repository at this point in the history
* Add libspng

* cleanup

* perf mark

* optimize performance of io

* don't draw immediately on image

* remove antialiasing from getIOModule

* compile with -fPIC

* a little perf optimization for png and bmp

* fix: implement libspng on windows

* chore: update packages

* ci: set $HOME to the same drive as the build directory

Workaround from: esy/esy#1083 (comment)

* ci: use stable version of esy

* chore: update libspng

* iterate throug image in single flat loop

Co-authored-by: Torben Ewert <[email protected]>
  • Loading branch information
eWert-Online and eWert-Online authored Dec 16, 2021
1 parent 2faf582 commit 5bbbc13
Show file tree
Hide file tree
Showing 32 changed files with 665 additions and 930 deletions.
5 changes: 5 additions & 0 deletions .ci/build-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
continueOnError: true
condition: and(eq(variables['AGENT.OS'], 'Windows_NT'), and(eq(variables['Build.Reason'], 'PullRequest'), and(succeeded(), ne(variables['Build.SourceBranch'], variables['System.PullRequest.TargetBranch']))))
displayName: "Print tar help"
# https://github.com/esy/pesy/commit/3aeaad2550edcf4ac8e259400279a564a92a194e
- powershell: Write-Host "##vso[task.setvariable variable=HOME;]D:\"
continueOnError: true
condition: eq(variables['AGENT.OS'], 'Windows_NT')
displayName: "Make sure $HOME is same is Agent.BuildDirectory"
- bash: |
# COMPUTE THE ESY INSTALL CACHE LOCATION AHEAD OF TIME
DESIRED_LEN="86"
Expand Down
2 changes: 1 addition & 1 deletion .ci/utils/use-esy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# steps to install esy globally

steps:
- script: "npm install -g @esy-nightly/esy"
- script: "npm install -g esy"
displayName: "install esy"
9 changes: 3 additions & 6 deletions bin/Main.re
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
open Odiff.ImageIO;
open Odiff.Diff;

let getIOModule = (filename, ~antialiasing) =>
let getIOModule = filename =>
Filename.extension(filename)
|> (
fun
| ".png" when antialiasing => (
(module ODiffIO.Png.BigarrayIO): (module ImageIO)
)
| ".png" => ((module ODiffIO.Png.IO): (module ImageIO))
| ".jpg"
| ".jpeg" => ((module ODiffIO.Jpg.IO): (module ImageIO))
Expand All @@ -34,8 +31,8 @@ let main =
antialiasing,
ignoreRegions,
) => {
module IO1 = (val getIOModule(img1Path, ~antialiasing));
module IO2 = (val getIOModule(img2Path, ~antialiasing));
module IO1 = (val getIOModule(img1Path));
module IO2 = (val getIOModule(img2Path));

module Diff = MakeDiff(IO1, IO2);

Expand Down
Loading

0 comments on commit 5bbbc13

Please sign in to comment.