From: Yedidya Feldblum Date: Wed, 23 Sep 2015 05:22:20 +0000 (-0700) Subject: Search unpadded strings in Range benchmarks X-Git-Tag: deprecate-dynamic-initializer~381 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=606fa0b6dd06630eb3a26e1571a494a3df151711;p=folly.git 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 --- diff --git a/folly/test/RangeFindBenchmark.cpp b/folly/test/RangeFindBenchmark.cpp index 2c920b72..2194ebb4 100644 --- a/folly/test/RangeFindBenchmark.cpp +++ b/folly/test/RangeFindBenchmark.cpp @@ -167,7 +167,7 @@ void countHits(Func func, size_t n) { template 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);