Besides what /u/adnukator said:
- Instead of your nested loop, tell the benchmark framework what arguments you need.
- Lookup tables perform better on monotonically increasing numbers. I think a better comparison would be a randomized array of values from which to pick arguments.
Here's what the benchmark looks like:
#include <array>
#include <algorithm>
#include