Skip to content

Task: Don't use an unordered map to store metas

We always provide all the meta after preparse, and even if we weren't storing all of those, we just return a default initialized string when the meta wasn't stored. This can be done with an std::array which costs nothing at runtime

benchmarks:

  • before
---------------------------------------------------------------------
Benchmark                           Time             CPU   Iterations
---------------------------------------------------------------------
BenchSetMeta                      557 ns          557 ns      1289251
BenchSetMeta                      562 ns          562 ns      1289251
BenchSetMeta                      563 ns          563 ns      1289251
BenchSetMeta                      565 ns          565 ns      1289251
BenchSetMeta                      563 ns          563 ns      1289251
BenchSetMeta                      563 ns          563 ns      1289251
BenchSetMeta                      564 ns          564 ns      1289251
BenchSetMeta                      563 ns          563 ns      1289251
BenchSetMeta                      563 ns          563 ns      1289251
BenchSetMeta                      568 ns          568 ns      1289251
BenchSetMeta_mean                 563 ns          563 ns           10
BenchSetMeta_median               563 ns          563 ns           10
BenchSetMeta_stddev              2.68 ns         2.69 ns           10
BenchSetMeta_cv                  0.48 %          0.48 %            10
BenchSetAndReadMeta               715 ns          715 ns       957208
BenchSetAndReadMeta               733 ns          733 ns       957208
BenchSetAndReadMeta               722 ns          722 ns       957208
BenchSetAndReadMeta               688 ns          688 ns       957208
BenchSetAndReadMeta               701 ns          701 ns       957208
BenchSetAndReadMeta               698 ns          698 ns       957208
BenchSetAndReadMeta               698 ns          697 ns       957208
BenchSetAndReadMeta               678 ns          678 ns       957208
BenchSetAndReadMeta               699 ns          699 ns       957208
BenchSetAndReadMeta               683 ns          683 ns       957208
BenchSetAndReadMeta_mean          702 ns          702 ns           10
BenchSetAndReadMeta_median        698 ns          698 ns           10
BenchSetAndReadMeta_stddev       17.4 ns         17.4 ns           10
BenchSetAndReadMeta_cv           2.49 %          2.48 %            10
  • after:
---------------------------------------------------------------------
Benchmark                           Time             CPU   Iterations
---------------------------------------------------------------------
BenchSetMeta                      273 ns          273 ns      2571612
BenchSetMeta                      273 ns          273 ns      2571612
BenchSetMeta                      273 ns          273 ns      2571612
BenchSetMeta                      273 ns          273 ns      2571612
BenchSetMeta                      274 ns          274 ns      2571612
BenchSetMeta                      272 ns          272 ns      2571612
BenchSetMeta                      271 ns          271 ns      2571612
BenchSetMeta                      272 ns          272 ns      2571612
BenchSetMeta                      272 ns          272 ns      2571612
BenchSetMeta                      271 ns          271 ns      2571612
BenchSetMeta_mean                 272 ns          272 ns           10
BenchSetMeta_median               272 ns          272 ns           10
BenchSetMeta_stddev             0.973 ns        0.973 ns           10
BenchSetMeta_cv                  0.36 %          0.36 %            10
BenchSetAndReadMeta               381 ns          381 ns      1823686
BenchSetAndReadMeta               382 ns          382 ns      1823686
BenchSetAndReadMeta               382 ns          382 ns      1823686
BenchSetAndReadMeta               381 ns          381 ns      1823686
BenchSetAndReadMeta               383 ns          383 ns      1823686
BenchSetAndReadMeta               386 ns          386 ns      1823686
BenchSetAndReadMeta               386 ns          386 ns      1823686
BenchSetAndReadMeta               384 ns          383 ns      1823686
BenchSetAndReadMeta               385 ns          384 ns      1823686
BenchSetAndReadMeta               385 ns          384 ns      1823686
BenchSetAndReadMeta_mean          384 ns          383 ns           10
BenchSetAndReadMeta_median        384 ns          383 ns           10
BenchSetAndReadMeta_stddev       1.99 ns         1.81 ns           10
BenchSetAndReadMeta_cv           0.52 %          0.47 %            10

Merge request reports

Loading