From 2a9865d93c91c2c1d0e2f68c8783aaf08f1dd2c5 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 6 Jan 2020 16:50:57 +0300 Subject: test: add a comment for the benchmarks --- test/benchmarks/lexer.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/benchmarks/lexer.cpp b/test/benchmarks/lexer.cpp index 3eb895c..5475c82 100644 --- a/test/benchmarks/lexer.cpp +++ b/test/benchmarks/lexer.cpp @@ -2,6 +2,16 @@ #include +#include +#include + +// I noticed std::regex_search cropping up in profiling results. +// Switching to boost::regex_search yielded a huge benefit: sometimes a 15x +// increase in regex matching (on VS builds in particular). +// Should be easily reproducible using these micro-benchmarks. + +namespace { + class NumberExamples : public benchmark::Fixture { protected: std::vector m_numbers{ @@ -24,6 +34,8 @@ protected: }; }; +} + BENCHMARK_F(NumberExamples, StdParseNumber)(benchmark::State& state) { using namespace math::server::lexer::details; for (auto _ : state) { -- cgit v1.2.3