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

Function BM_AllocateMap

eval/tests/allocation_benchmark_test.cc:145–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143BENCHMARK(BM_AllocateError);
144
145static void BM_AllocateMap(benchmark::State& state) {
146 google::protobuf::Arena arena;
147 std::string expr("{1: 2, 3: 4}");
148 auto builder = CreateCelExpressionBuilder();
149 ASSERT_OK(RegisterBuiltinFunctions(builder->GetRegistry()));
150
151 ASSERT_OK_AND_ASSIGN(ParsedExpr parsed_expr, Parse(expr));
152 ASSERT_OK_AND_ASSIGN(auto cel_expr,
153 builder->CreateExpression(&parsed_expr.expr(),
154 &parsed_expr.source_info()));
155
156 for (auto _ : state) {
157 Activation activation;
158 ASSERT_OK_AND_ASSIGN(CelValue result,
159 cel_expr->Evaluate(activation, &arena));
160 ASSERT_TRUE(result.IsMap());
161 }
162}
163
164BENCHMARK(BM_AllocateMap);
165

Callers

nothing calls this directly

Calls 4

RegisterBuiltinFunctionsFunction · 0.85
GetRegistryMethod · 0.80
IsMapMethod · 0.45

Tested by

no test coverage detected