LibGfx/CCITT: Make decoding of wide ccitt3-2d and ccitt-4 images faster#26083
Merged
nico merged 1 commit intoSerenityOS:masterfrom Jul 31, 2025
Merged
LibGfx/CCITT: Make decoding of wide ccitt3-2d and ccitt-4 images faster#26083nico merged 1 commit intoSerenityOS:masterfrom
nico merged 1 commit intoSerenityOS:masterfrom
Conversation
`take_first()` on a Vector is O(n), meaning this function used to have
O(n^2) behavior in the width of an image.
We can just use a span instead, which can be be advanced in O(1) time.
Makes
pdf --debugging-stats ~/Downloads/ignition.pdf
go from 10.2s to 6.7s, 34% faster.
Makes the first 50 pages of
pdf --debugging-stats pdf-stuff/Mellor_ACTITC_10.pdf
go from 65.9s to 13.2s, 80% faster.
Fixes SerenityOS#26082.
LucasChollet
approved these changes
Jul 31, 2025
Member
LucasChollet
left a comment
There was a problem hiding this comment.
LGTM, and thanks for the perf improvement!
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.
take_first()on a Vector is O(n), meaning this function used to have O(n^2) behavior in the width of an image.We can just use a span instead, which can be be advanced in O(1) time.
Makes
go from 10.2s to 6.7s, 34% faster.
Makes the first 50 pages of
go from 65.9s to 13.2s, 80% faster.
Fixes #26082.