Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
std::io: Optimize u64_from_be_bytes()
Instead of reading a byte at a time in a loop we copy the relevant bytes into a temporary vector of size eight. We can then read the value from the temporary vector using a single u64 read. LLVM seems to be able to optimize this almost scarily good.
- Loading branch information
Showing
1 changed file
with
19 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
0b3311c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from alexcrichton
at c-a@0b3311c
0b3311c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging c-a/rust/u64_from_be_bytes = 0b3311c into auto
0b3311c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c-a/rust/u64_from_be_bytes = 0b3311c merged ok, testing candidate = f411b94
0b3311c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/3494
success: http://buildbot.rust-lang.org/builders/auto-mac-32-nopt-c/builds/1336
success: http://buildbot.rust-lang.org/builders/auto-mac-32-nopt-t/builds/1340
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/3496
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/2597
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/2602
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/3512
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/2600
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/2606
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/3514
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/2600
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/2605
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/2674
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/3502
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/2604
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/2608
success: http://buildbot.rust-lang.org/builders/auto-bsd-64-opt/builds/3275
0b3311c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = f411b94