about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-01-17 21:52:03 +0000
committerbors <bors@rust-lang.org>2017-01-17 21:52:03 +0000
commitc07a6ae77cd4ceb3cf591d34c5608ca91d1f75d4 (patch)
tree23b49663e71486df7f582fd55c09fad56ee1aef7 /src/rustllvm/RustWrapper.cpp
parentbd8e9b0c828bce489eb948853a6cf86b69b26799 (diff)
parenta54ddfb676c59bcf0dd3dc8ef869a6e5ac4afc0b (diff)
downloadrust-c07a6ae77cd4ceb3cf591d34c5608ca91d1f75d4.tar.gz
rust-c07a6ae77cd4ceb3cf591d34c5608ca91d1f75d4.zip
Auto merge of #37972 - bluss:iter-find-is-on-a-roll, r=sfackler
Improve the slice iterator's searching methods

Improve all, any, find, position, rposition by explicitly unrolling the loop for the slice iterators.

- Introduce a few extension methods and functions for raw pointers make the new code easy to express
- Introduce helper methods `search_while, rsearch_while` that generalize all the searching methods

LLVM doesn't unroll the loop in `.find()` by default (clang is the same), so performance benefits a lot from explicit unrolling here. An iterator method without conditional exits (like `.fold()`) does not need this on the other hand.

One of the raw pointer extension methods is `fn post_inc(&mut self) -> Self` which is the rustic equivalent of “`ptr++`”, and it is a nice way to express the raw pointer loop (see commit 3).

Specific development notes about `search_while`: I tried both computing an end pointer "rounded" to 4, as well as the `ptrdistance >= 4` loop condition, ptrdistance was better. I tried handling the last 0-3 elements unrolled or with a while loop, the loop was better.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions