{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/31100","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/31100/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/31100/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/31100/events","html_url":"https://github.com/rust-lang/rust/issues/31100","id":128056959,"number":31100,"title":"BufReader's seek implementation is somewhat irritating for performance","user":{"login":"taralx","id":1036808,"avatar_url":"https://avatars.githubusercontent.com/u/1036808?v=3","gravatar_id":"","url":"https://api.github.com/users/taralx","html_url":"https://github.com/taralx","followers_url":"https://api.github.com/users/taralx/followers","following_url":"https://api.github.com/users/taralx/following{/other_user}","gists_url":"https://api.github.com/users/taralx/gists{/gist_id}","starred_url":"https://api.github.com/users/taralx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taralx/subscriptions","organizations_url":"https://api.github.com/users/taralx/orgs","repos_url":"https://api.github.com/users/taralx/repos","events_url":"https://api.github.com/users/taralx/events{/privacy}","received_events_url":"https://api.github.com/users/taralx/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-libs","name":"A-libs","color":"d7e102"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-22T00:52:27Z","updated_at":"2016-01-27T21:27:09Z","closed_at":null,"body":"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.\r\n\r\nAdditionally, 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.\r\n\r\nI'd recommend removing this behavior and moving it to unwrap() or another method (sync?), but it's now baked into a stable API.\r\n\r\nWhat are the options now?"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/175862479","html_url":"https://github.com/rust-lang/rust/issues/31100#issuecomment-175862479","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/31100","id":175862479,"user":{"login":"taralx","id":1036808,"avatar_url":"https://avatars.githubusercontent.com/u/1036808?v=3","gravatar_id":"","url":"https://api.github.com/users/taralx","html_url":"https://github.com/taralx","followers_url":"https://api.github.com/users/taralx/followers","following_url":"https://api.github.com/users/taralx/following{/other_user}","gists_url":"https://api.github.com/users/taralx/gists{/gist_id}","starred_url":"https://api.github.com/users/taralx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taralx/subscriptions","organizations_url":"https://api.github.com/users/taralx/orgs","repos_url":"https://api.github.com/users/taralx/repos","events_url":"https://api.github.com/users/taralx/events{/privacy}","received_events_url":"https://api.github.com/users/taralx/received_events","type":"User","site_admin":false},"created_at":"2016-01-27T21:27:09Z","updated_at":"2016-01-27T21:27:09Z","body":"I'm not trying to avoid seeking the underlying stream, I'm trying to avoid dumping the buffer. In my implementation, small seeks that fit in the existing buffer cause a call to self.inner.seek(SeekFrom::Current(0))."}}