Commit 606fa0b6 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by facebook-github-bot-9

Search unpadded strings in Range benchmarks

Summary: [Folly] Search unpadded strings in `Range` benchmarks.

`vstr` has padding to adjust alignment. `vstrp` is a view into `vstr` that skips the padding, so that searches start out unaligned.

Before this diff, haystack is 8-byte aligned: `uintptr_t(haystack.begin()) % 8 == 0`. After this diff, it is not.

Reviewed By: @​@​nbronson

Differential Revision: D2468934
parent 178d3b45
......@@ -167,7 +167,7 @@ void countHits(Func func, size_t n) {
template <class Func>
void findFirstOfRange(StringPiece needles, Func func, size_t n) {
FOR_EACH_RANGE (i, 0, n) {
const StringPiece haystack = vstr[i % kVstrSize];
const StringPiece haystack = vstrp[i % kVstrSize];
doNotOptimizeAway(func(haystack, needles));
char x = haystack[0];
doNotOptimizeAway(&x);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment