-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
std::trie: use unsafe code to give a 3x speed up to the iterator.
This stores the stack of iterators inline (we have a maximum depth with `uint` keys), and then uses direct pointer offsetting to manipulate it, in a blazing fast way: Before: bench_iter_large ... bench: 43187 ns/iter (+/- 3082) bench_iter_small ... bench: 618 ns/iter (+/- 288) After: bench_iter_large ... bench: 13497 ns/iter (+/- 1575) bench_iter_small ... bench: 220 ns/iter (+/- 91)
- Loading branch information
Showing
1 changed file
with
118 additions
and
39 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
0148055
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 huonw@0148055
0148055
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 huonw/rust/trie-internal-iter = 0148055 into auto
0148055
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.
huonw/rust/trie-internal-iter = 0148055 merged ok, testing candidate = f4498c7
0148055
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/3626
success: http://buildbot.rust-lang.org/builders/auto-mac-32-nopt-c/builds/1468
success: http://buildbot.rust-lang.org/builders/auto-mac-32-nopt-t/builds/1470
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/3627
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/2727
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/2733
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/3641
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/2729
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/2735
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/3643
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/2729
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/2734
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/2803
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/3633
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/2734
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/2739
success: http://buildbot.rust-lang.org/builders/auto-bsd-64-opt/builds/3404
0148055
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 = f4498c7