| 1149 | BENCHMARK(BM_ExistsComprehensionWorstCase)->Range(1, 1 << 10); |
| 1150 | |
| 1151 | void BM_AllComprehensionBestCase(benchmark::State& state) { |
| 1152 | ASSERT_OK_AND_ASSIGN(ParsedExpr parsed_expr, |
| 1153 | Parse("my_int_list.exists(x, x != 1)")); |
| 1154 | |
| 1155 | RuntimeOptions options = GetOptions(); |
| 1156 | auto runtime = StandardRuntimeOrDie(options); |
| 1157 | |
| 1158 | ASSERT_OK_AND_ASSIGN(auto cel_expr, ProtobufRuntimeAdapter::CreateProgram( |
| 1159 | *runtime, parsed_expr)); |
| 1160 | |
| 1161 | google::protobuf::Arena arena; |
| 1162 | Activation activation; |
| 1163 | |
| 1164 | auto list_builder = cel::NewListValueBuilder(&arena); |
| 1165 | |
| 1166 | ASSERT_THAT(list_builder->Add(IntValue(1)), IsOk()); |
| 1167 | |
| 1168 | activation.InsertOrAssignValue("my_int_list", |
| 1169 | std::move(*list_builder).Build()); |
| 1170 | |
| 1171 | for (auto _ : state) { |
| 1172 | ASSERT_OK_AND_ASSIGN(cel::Value result, |
| 1173 | cel_expr->Evaluate(&arena, activation)); |
| 1174 | ASSERT_TRUE(result.IsBool()); |
| 1175 | ASSERT_FALSE(result.GetBool().NativeValue()); |
| 1176 | } |
| 1177 | } |
| 1178 | |
| 1179 | BENCHMARK(BM_AllComprehensionBestCase); |
| 1180 |
nothing calls this directly
no test coverage detected