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
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);