Ensure that a value is computed even after optimization.
Synopsis
Declared in <folly/BenchmarkUtil.h>
template<class T>
void
doNotOptimizeAway(T const& datum);
Description
Call doNotOptimizeAway(var) to ensure that var will be computed even post‐optimization. Use it for variables that are computed during benchmarking but otherwise are useless. The compiler tends to do a good job at eliminating unused variables, and this function fools it into thinking var is in fact needed.
Parameters
Name |
Description |
datum |
The value to keep from being optimized away. |
Created with MrDocs