-
Notifications
You must be signed in to change notification settings - Fork 0
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
Write images in buffers #1
base: master
Are you sure you want to change the base?
Conversation
I'll check it tomorrow, I need a fresh brain for this one 😰 |
I feel too bad to ask for a review, so I will first try to describe what is going on. Give me a minute, please. (Wrote this last year, in my free time and I need some time to remember everything myself...) |
ha I see, thanks! also I would be interested to know about the performance gains, if it does not take you too much time |
Quickly ran benchmarks, and basically it is not always "better", and I remembered this was the primary reason I did not open this PR first 😅 The collected benchmark results and profiles were quite hard to understand at the moment, but I'll try to summarize them here. Attaching the benchmark results below 🙏 i) ~900kb PNG
ii) ~2mb PNG
|
the gains on 2mb + sync.Pool are impressive the allocs/op on the 900kb image is quite high, do you know why there is much more allocs than for the 2mb png? |
Yeah that's really weird, maybe there is some difference in the format (PNG can contain many things) This hobby work does not prevent the other development 👍 |
@openrm/dev
This is an attempt to register/write the image streams as they are, whenever possible.
It is done by replacing the existing redundant memory copies (full reads) with byte-wise operations, and instead doing it only once for adding the
Length
metadata on each object.All tests are passing, and I tested it in the current PDF service of ours also.