aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-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) {