LibPDF+LibGfx: Decode Mellor_ACTITC_10.pdf faster#26235
Merged
nico merged 4 commits intoSerenityOS:masterfrom Oct 3, 2025
Merged
LibPDF+LibGfx: Decode Mellor_ACTITC_10.pdf faster#26235nico merged 4 commits intoSerenityOS:masterfrom
nico merged 4 commits intoSerenityOS:masterfrom
Conversation
This avoids the performance costs of calling `set_pixel` (which includes a bunch of VERIFY) that valgrind measured as 5% on: `Build/lagom/bin/pdf --render out.png PDF/Mellor_ACTITC_10.pdf --page 4`
Makes JBIG2's composite_bilevel_image() drop from 25% to 18% in profiles.
2f55e1b to
86b6630
Compare
Contributor
Hendiadyoin1
left a comment
There was a problem hiding this comment.
one small nit from my end
d2885c1 to
2d9a4d6
Compare
Member
Author
|
I dropped the last commit in favor of #26239. |
Contributor
|
Thanks! I haven't profiled it, but the CCITT (and JBIG2) hashtable code is pretty inefficient. You put more efficient code in JPEGLoader (maybe that's even the same type of hashtable as in CCITT and JBIG2?), and Compress::CanonicalCodes is iirc more efficient still. (And https://www.hanshq.net/zip.html is still a bit nicer than CanonicalCodes – see e.g. #25005) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #26082
This is mainly low-hanging fruits, but it still gives a nice perf improvement.
From:
To: