BufReader should provide a way to seek without dumping the buffer #31100
Closed
Description
BufReader's seek() implementation always dumps the buffer. This is not good for performance, where users may want to skip a variable amount of buffered data -- only BufReader really knows if it's reasonable to move the pointer or not.
Additionally, only BufReader can know if the pointer can be reversed or not -- so there's absolutely no cheap way to "unget" data from BufReader, even if you know it's seekable.
I'd recommend removing this behavior and moving it to unwrap() or another method (sync?), but it's now baked into a stable API.
What are the options now?