aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/benchmarks/lexer.cpp
blob: 0f3151ff2dd365c1c0a385c0ab7c07e42f6774e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <server/lexer/details/parse.hpp>

#include <benchmark/benchmark.h>

class SelectionOfNumbers : public benchmark::Fixture {
protected:
    std::vector<std::string_view> m_numbers{
        "0",
        "123",
        "0.123",
        ".123",
        "1e9",
        "1.87E-18",
        "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
    };
};

BENCHMARK_F(SelectionOfNumbers, ParseStdRegex)(benchmark::State &state) {
    using namespace math::server::lexer::details;
    for (auto _ : state) {
        for (const auto& src : m_numbers) {
            parse_number(src);
        }
    }
}