Skip to content
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

New PNG inputs for benchmarking non-compressed, non-filtered data. #420

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

anforowicz
Copy link
Contributor

PTAL?

The new test images are somewhat artificial, but they help to see the performance of the bulk of the PNG decoding code. Runtime overhead of this code is relatively small when compared to the overhead of decompression (mostly in the fdeflate crate) and unfiltering (in src/filter.rs), but performance of this code is still important (e.g. as discussed in another discussion thread, optimizing this code can yield 10+% of gains for a more realistic test corpus). And I think that these new test images will be a useful tool for evaluating performance of this code (which may be more difficult to confidently measure using other test inputs).

I am adding 2 separate images, because I think that:

  • The 128x128 image will be useful for evaluating performance of copying the image data out of a PNG file
  • The 8x8 image will be useful for evaluating constant costs (e.g. when trying to optimize handling of small images - favicons, emojis, etc.)

Copy link
Contributor

@fintelia fintelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would be better to add a new benchmark that constructed these uncompressed files on the fly. That would enable us to have a larger number of variations without having to check in all the (uncompressed!) files into git.

In particular, it might be interesting to try breaking up the files into different sized iDAT chunks (8KB vs 64KB vs unlimited), and to try some much larger files (some decoders have a performance cliff when the image no longer fits in the L2 cache).

tests/benches/noncompressed/src/main.rs Outdated Show resolved Hide resolved
tests/benches/noncompressed/src/main.rs Outdated Show resolved Hide resolved
@anforowicz
Copy link
Contributor Author

I wonder if it would be better to add a new benchmark that constructed these uncompressed files on the fly. That would enable us to have a larger number of variations without having to check in all the (uncompressed!) files into git.

Sounds good. I don't have a strong reason to work with actual files (rather than generating inputs at test runtime), but let me list some weak reasons below:

  • Consistency with the existing benchmarks
  • Being able to use the PNGs in other benchmarks (e.g. in benchmarks that also cover C++/Rust FFI, or in benchmarks of other decoders like libpng or wuffs)

@anforowicz
Copy link
Contributor Author

@fintelia - what are the next steps for this PR? Are there any actions I should take from my side? (once this gets merged, I plan to rebase and submit the next follow-up I have lined up here: master...anforowicz:image-png:idat-straight-to-zlibstream)

@fintelia fintelia merged commit ec2d257 into image-rs:master Nov 9, 2023
19 checks passed
@anforowicz anforowicz deleted the noncompressed-benches branch January 3, 2024 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants