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

Function BM_Comparisons

eval/tests/expression_builder_benchmark_test.cc:267–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265 ->Arg(BenchmarkParam::kRecursivePlanningWithConstantFolding);
266
267void BM_Comparisons(benchmark::State& state) {
268 auto param = static_cast<BenchmarkParam>(state.range(0));
269 state.SetLabel(LabelForParam(param));
270
271 ASSERT_OK_AND_ASSIGN(ParsedExpr expr, parser::Parse(R"(
272 v11 < v12 && v12 < v13
273 && v21 > v22 && v22 > v23
274 && v31 == v32 && v32 == v33
275 && v11 != v12 && v12 != v13
276 )"));
277
278 google::protobuf::Arena arena;
279 InterpreterOptions options = OptionsForParam(param, arena);
280
281 auto builder = CreateCelExpressionBuilder(options);
282 auto reg_status = RegisterBuiltinFunctions(builder->GetRegistry());
283 ASSERT_OK(reg_status);
284
285 for (auto _ : state) {
286 ASSERT_OK_AND_ASSIGN(
287 auto expression,
288 builder->CreateExpression(&expr.expr(), &expr.source_info()));
289 arena.Reset();
290 }
291}
292
293BENCHMARK(BM_Comparisons)
294 ->Arg(BenchmarkParam::kDefault)

Callers

nothing calls this directly

Calls 1

LabelForParamFunction · 0.85

Tested by

no test coverage detected