(b *testing.B)
| 279 | } |
| 280 | |
| 281 | func BenchmarkCompile(b *testing.B) { |
| 282 | for _, tst := range policyTests { |
| 283 | r := newRunner(tst.name, tst.expr, tst.parseOpts) |
| 284 | env, ast, iss := r.compile(b, tst.envOpts, []CompilerOption{}) |
| 285 | if iss.Err() != nil { |
| 286 | b.Fatalf("Compile() failed: %v", iss.Err()) |
| 287 | } |
| 288 | r.setup(b, env, ast) |
| 289 | r.bench(b) |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | func newRunner(name, expr string, parseOpts []ParserOption, opts ...cel.EnvOption) *runner { |
| 294 | return &runner{ |