| 1085 | BENCHMARK(BM_ListComprehension_Trace)->Range(1, 1 << 16); |
| 1086 | |
| 1087 | void BM_ExistsComprehensionBestCase(benchmark::State& state) { |
| 1088 | ASSERT_OK_AND_ASSIGN(ParsedExpr parsed_expr, |
| 1089 | Parse("my_int_list.exists(x, x == 1)")); |
| 1090 | |
| 1091 | RuntimeOptions options = GetOptions(); |
| 1092 | auto runtime = StandardRuntimeOrDie(options); |
| 1093 | |
| 1094 | ASSERT_OK_AND_ASSIGN(auto cel_expr, ProtobufRuntimeAdapter::CreateProgram( |
| 1095 | *runtime, parsed_expr)); |
| 1096 | |
| 1097 | google::protobuf::Arena arena; |
| 1098 | Activation activation; |
| 1099 | |
| 1100 | auto list_builder = cel::NewListValueBuilder(&arena); |
| 1101 | |
| 1102 | ASSERT_THAT(list_builder->Add(IntValue(1)), IsOk()); |
| 1103 | |
| 1104 | activation.InsertOrAssignValue("my_int_list", |
| 1105 | std::move(*list_builder).Build()); |
| 1106 | |
| 1107 | for (auto _ : state) { |
| 1108 | ASSERT_OK_AND_ASSIGN(cel::Value result, |
| 1109 | cel_expr->Evaluate(&arena, activation)); |
| 1110 | ASSERT_TRUE(result.IsBool()); |
| 1111 | ASSERT_TRUE(result.GetBool().NativeValue()); |
| 1112 | } |
| 1113 | } |
| 1114 | |
| 1115 | BENCHMARK(BM_ExistsComprehensionBestCase); |
| 1116 |
nothing calls this directly
no test coverage detected