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

Switch to a Read API that does not initialize slices, once stable #186

Open
Shnatsel opened this issue Jan 3, 2023 · 0 comments
Open

Switch to a Read API that does not initialize slices, once stable #186

Shnatsel opened this issue Jan 3, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@Shnatsel
Copy link
Contributor

Shnatsel commented Jan 3, 2023

What can be improved or is missing?

Right now initializing slices takes to be read into takes a non-trivial amount of time. Reading is not parallelized, so it becomes a bottleneck on lightly compressed images and/or on machines with a high core count.

Implementation Approach

In the general case we need Rust's Read trait to stop requiring slices to be initialized. There's an accepted RFC and a tracking issue for it: rust-lang/rust#78485

Technically we could make a specialized fast path for reading from in-memory buffers that bypasses the Read wrapper and can call .extend_from_slice() in the Vec instead of going through the Read implementation, but it's probably not worth the complexity.

@Shnatsel Shnatsel added the enhancement New feature or request label Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant