Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

more efficient seeks #9

Open
dignifiedquire opened this issue Nov 14, 2018 · 3 comments
Open

more efficient seeks #9

dignifiedquire opened this issue Nov 14, 2018 · 3 comments

Comments

@dignifiedquire
Copy link
Contributor

I am looking into using seeking quite a bit and was wondering if it was possible to upgrade the seeking implementation like it is done here: https://github.com/gcarq/seek_bufread

the stdlib will hopefully get sth similar eventually, ref: rust-lang/rust#31100

@abonander
Copy link
Owner

Are you looking for something like the unstable BufReader::seek_relative()? https://doc.rust-lang.org/nightly/std/io/struct.BufReader.html#method.seek_relative

@dignifiedquire
Copy link
Contributor Author

dignifiedquire commented Nov 16, 2018 via email

@abonander
Copy link
Owner

abonander commented Nov 17, 2018

So you want the reader to store the absolute offset, to the best of its knowledge, and optimize for when seeks fall within the buffer.

That's not unreasonable, but I think to avoid surprises this should be implemented as a wrapper type or at the very least a separate method. For cases where the user is expecting the data at a local offset to change in the underlying reader, this optimization would cause seeks to yield stale data. I'd rather keep the stdlib semantics for BufReader unless those change.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants