MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / BM_Parse

Function BM_Parse

parser/parser_benchmarks.cc:263–277  ·  view source on GitHub ↗

This is not a proper microbenchmark, but is used to check for major regressions in the ANTLR generated code or concurrency issues. Each benchmark iteration parses all of the basic test cases from the unit-tests.

Source from the content-addressed store, hash-verified

261// regressions in the ANTLR generated code or concurrency issues. Each benchmark
262// iteration parses all of the basic test cases from the unit-tests.
263void BM_Parse(benchmark::State& state) {
264 std::vector<Macro> macros = Macro::AllMacros();
265 macros.push_back(cel::OptMapMacro());
266 macros.push_back(cel::OptFlatMapMacro());
267 ParserOptions options;
268 options.enable_optional_syntax = true;
269 options.enable_quoted_identifiers = true;
270 for (auto s : state) {
271 for (const auto& test_case : GetTestCases()) {
272 auto result = ParseWithMacros(test_case.expr, macros, "<input>", options);
273 ABSL_DCHECK_EQ(result.ok(), test_case.result == ParseResult::kSuccess);
274 benchmark::DoNotOptimize(result);
275 }
276 }
277}
278
279BENCHMARK(BM_Parse)->ThreadRange(1, std::thread::hardware_concurrency());
280

Callers

nothing calls this directly

Calls 4

AllMacrosFunction · 0.85
GetTestCasesFunction · 0.85
ParseWithMacrosFunction · 0.85
okMethod · 0.45

Tested by

no test coverage detected