aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-01-06 16:50:57 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-01-06 16:50:57 +0300
commit2a9865d93c91c2c1d0e2f68c8783aaf08f1dd2c5 (patch)
tree70d7baa3d888c5035e2e362e287fc5a8c8916bd9 /test
parentlexer: fix GCC build errors (diff)
downloadmath-server-2a9865d93c91c2c1d0e2f68c8783aaf08f1dd2c5.tar.gz
math-server-2a9865d93c91c2c1d0e2f68c8783aaf08f1dd2c5.zip
test: add a comment for the benchmarks
Diffstat (limited to '')
-rw-r--r--test/benchmarks/lexer.cpp12
1 files changed, 12 insertions, 0 deletions
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 <benchmark/benchmark.h>
+#include <string_view>
+#include <vector>
+
+// 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<std::string_view> m_numbers{
@@ -24,6 +34,8 @@ protected:
};
};
+}
+
BENCHMARK_F(NumberExamples, StdParseNumber)(benchmark::State& state) {
using namespace math::server::lexer::details;
for (auto _ : state) {