Skip to content

Add a benchmark utility and start using it

This is a minimal integration of google benchmark in order to check that some of the future changes actually bring something to the balance.

In order to try it, this MR also includes an optimization of the utils::url::decode function.

Before:

----------------------------------------------------------------
Benchmark                      Time             CPU   Iterations
----------------------------------------------------------------
BenchUrlDecode               198 ns          198 ns      3412650
BenchUrlDecode               198 ns          198 ns      3412650
BenchUrlDecode               207 ns          207 ns      3412650
BenchUrlDecode               211 ns          211 ns      3412650
BenchUrlDecode               209 ns          209 ns      3412650
BenchUrlDecode               209 ns          209 ns      3412650
BenchUrlDecode               206 ns          206 ns      3412650
BenchUrlDecode               214 ns          214 ns      3412650
BenchUrlDecode               218 ns          218 ns      3412650
BenchUrlDecode               223 ns          223 ns      3412650
BenchUrlDecode_mean          209 ns          209 ns           10
BenchUrlDecode_median        209 ns          209 ns           10
BenchUrlDecode_stddev       7.85 ns         7.85 ns           10
BenchUrlDecode_cv           3.75 %          3.75 %            10

after:

----------------------------------------------------------------
Benchmark                      Time             CPU   Iterations
----------------------------------------------------------------
BenchUrlDecode              91.1 ns         91.1 ns      7736626
BenchUrlDecode              88.4 ns         88.4 ns      7736626
BenchUrlDecode              88.5 ns         88.5 ns      7736626
BenchUrlDecode              88.9 ns         88.9 ns      7736626
BenchUrlDecode              89.4 ns         89.4 ns      7736626
BenchUrlDecode              87.9 ns         87.9 ns      7736626
BenchUrlDecode              88.6 ns         88.6 ns      7736626
BenchUrlDecode              89.1 ns         89.1 ns      7736626
BenchUrlDecode              88.2 ns         88.2 ns      7736626
BenchUrlDecode              88.6 ns         88.6 ns      7736626
BenchUrlDecode_mean         88.9 ns         88.8 ns           10
BenchUrlDecode_median       88.6 ns         88.6 ns           10
BenchUrlDecode_stddev      0.898 ns        0.897 ns           10
BenchUrlDecode_cv           1.01 %          1.01 %            10

which is a 57.5% improvement

Merge request reports