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

Function BM_ParseAddressMatcherMatchesVar

codelab/network_functions_test.cc:320–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318}
319
320void BM_ParseAddressMatcherMatchesVar(benchmark::State& state) {
321 bool optimize = state.range(0);
322 auto runner = BenchmarkState::Create(optimize);
323
324 ABSL_CHECK_OK(runner.status());
325
326 auto program = runner->MakeProgram(
327 "net.parseAddressMatcher('8.8.0.0-8.8.255.255').containsAddress(net."
328 "parseAddress(ip))");
329 ABSL_CHECK_OK(program.status());
330
331 google::protobuf::Arena arena;
332 Activation activation;
333 activation.InsertOrAssignValue("ip", StringValue::From("8.8.4.4", &arena));
334 for (auto s : state) {
335 auto result = (*program)->Evaluate(&arena, activation);
336 ABSL_CHECK_OK(result.status());
337 }
338}
339
340BENCHMARK(BM_ParseAddress)->Arg(0)->Arg(1);
341BENCHMARK(BM_ParseAddressVar)->Arg(0)->Arg(1);

Callers

nothing calls this directly

Calls 3

MakeProgramMethod · 0.80
InsertOrAssignValueMethod · 0.80
EvaluateMethod · 0.45

Tested by

no test coverage detected