3 ms·
Also looks like randString generation will dominate for small arrays for (size_t i = 0; i < kLookups; ++i) { benchmark::DoNotOptimize(std::find(vec.be
by petermcneeley 8y ago
Also looks like randString generation will dominate for small arrays
for (size_t i = 0; i < kLookups; ++i) {
benchmark::DoNotOptimize(std::find(vec.begin(), vec.end(), randString()));
}
Also does that allocate a new string every call?
- AstralStorm 8y agoYes, this benchmark is relatively flawed. Allocating a new string simulates heap fragmentation.
- petermcneeley 8y agoThe post was updated as the results were incorrect.