Optimize BufferedReader::read for large buffers.#18108
Merged
bors merged 1 commit intorust-lang:masterfrom Oct 20, 2014
mahkoh:buffered_reader
Merged
Optimize BufferedReader::read for large buffers.#18108bors merged 1 commit intorust-lang:masterfrom mahkoh:buffered_reader
bors merged 1 commit intorust-lang:masterfrom
mahkoh:buffered_reader
Conversation
Contributor
Author
|
It might also be reasonable to use another bound such as |
Member
|
Java makes the same optimization: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/io/BufferedReader.java#195, though it calls 👍 here |
Member
|
Could you add a test for this as well? Just a smoke test ensuring that a gargantuan read bypasses the buffer. Other than that r=me |
Contributor
Author
|
Updated. |
This optimizes `read` for the case in which the number of bytes requested is larger than the internal buffer. Note that the first comparison occurs again right afterwards and should thus be free. The second comparison occurs only in the cold branch.
Contributor
Author
|
Updated. |
bors
added a commit
that referenced
this pull request
Oct 20, 2014
This optimizes `read` for the case in which the number of bytes requested is larger than the internal buffer. Note that the first comparison occurs again right afterwards and should thus be free. The second comparison occurs only in the cold branch.
lnicola
pushed a commit
to lnicola/rust
that referenced
this pull request
Sep 25, 2024
…kril fix: Handle lint attributes that are under `#[cfg_attr]` I forgot `cfg_attr` while working on rust-lang#18099. Although the original code also didn't handle that (although case lints specifically were correct, by virtue of using hir attrs).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This optimizes
readfor the case in which the number of bytesrequested is larger than the internal buffer. Note that the first
comparison occurs again right afterwards and should thus be free. The
second comparison occurs only in the cold branch.