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

Add BufRead + Seek bound on many decoders #2149

Merged
merged 2 commits into from
Feb 19, 2024

Conversation

fintelia
Copy link
Contributor

The purpose of this change is to allow future decoder improvements:

  • Experiments with the PNG crate have shown that working with a BufRead implementation rather than just a Read implementation can be faster.
  • The Seek bound is useful for decreasing the memory usage of the decoder. Instead of storing all image metadata as it is seen, a decoder can record the location in the file of specific chunks and then seek to them if/when they are queried.

At the same time, not all decoders are likely to need either of these and having looser trait bounds is nicer for users. Thus I left the existing Read bound for some decoders (and actually removed the Seek bound on TGA). After this change, the trait bounds are:

image

@fintelia fintelia merged commit 0ed15a8 into image-rs:next-version-0.25 Feb 19, 2024
31 checks passed
@fintelia fintelia deleted the bufread-seek branch February 19, 2024 20:45
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.

1 participant