-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup & optimize performance of IO (switch to libspng) #57
Conversation
@dmtrKovalenko Do you have any clue, why the windows pipeline gets an |
I'll spend some time on weekend with this |
Thanks for this, but I want to understand how having 1 implementation will help to implement buffers? Buffer will always be the encoded array data that we need to decode using specific codec, right?
Actually this type of lib where we are fighting for performance having optimizations like using raw pointers data without any data copying makes sense as for me, because making us as fast as possible. WDYT? |
I just realized that I had an error in my thought process. I still think libspng is an optimization over libpng in terms of speed though. |
Yeah I think that we can merge it but left 2 different decoders only for benchmarks 🙈 |
I am not sure I understand this correctly. You want to have libpng and libspng at the same time? |
Oh my gosh yeah that is not an option -__- I`ll get back to this code in a few hours with more fresh mind to figure everything out |
Well...let me first take a look, if I can optimize the performance of the PNG IO a bit further. |
re: Windows https://www.npmjs.com/package/@esy-nightly/esy/v/0.6.11-19279b |
@ManasJayanth doesn't work https://dev.azure.com/dmtrkovalenko/odiff/_build/results?buildId=285&view=results basically get back to downloading esy@nightly here |
@dmtrKovalenko In the build logs you linked, I don't think it's using the nightly I suggested. Am I missing something? |
@dmtrKovalenko We are currently still incrementing x and y. |
@dmtrKovalenko |
Sorry for so long delay, I had pretty busy period several months. I will take a look and merge this PR until the end of this week. Honestly, I Was scared on the amount of code to read (the new deps) 😔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Once again I am sorry for so long review
This PR is an effort to switch from
libpng
tolibspng
.This doubles the performance of
tiff
,bmp
andjpg
(probablywebp
andavif
too).The performance of
png
sadly drops by ~200ms (edit: ~100ms).This is because the encoder of
libspng
runs much faster compared tolibpng
when given a single byte array.Because png was the only format which didn't use the bigarray, but the row pointers, it now is a bit slower.
The encoder of
libspng
is not yet released officially, so maybe there are also some pending performance optimizations... 😄Using
libspng
also reduced the binary size by ~100kb.In the future, we could also think about using
miniz
instead ofzlib
. It is also lighter and in some cases faster than zlib.The big advantage that we get with this rewrite, is that all io implementations now use a bigarray to store and read their data. (Also we only have 1 PNG implementation now instead of 2).
So implementing something like #53 will probably get a bit easier.
We could also think about giving ocaml / reasonml users (me 😄 ) the ability to get the raw bigarray data out of the io functors.
@dmtrKovalenko What do you think?
Todo
Performance Benchmarks
BMP:
JPG / JPEG
PNG 😞
TIFF