MCPcopy Create free account
hub / github.com/cel-expr/cel-go / BenchmarkByCategory

Function BenchmarkByCategory

parser/parser_test.go:2553–2570  ·  view source on GitHub ↗

BenchmarkByCategory benchmarks parsing organized by workload categories.

(b *testing.B)

Source from the content-addressed store, hash-verified

2551
2552// BenchmarkByCategory benchmarks parsing organized by workload categories.
2553func BenchmarkByCategory(b *testing.B) {
2554 p := newBenchmarkCategoryParser(b)
2555 for _, cat := range benchCategories {
2556 b.Run(cat.name, func(b *testing.B) {
2557 b.ResetTimer()
2558 for i := 0; i < b.N; i++ {
2559 for _, tc := range cat.cases {
2560 src := common.NewTextSource(tc.I)
2561 _, errs := p.Parse(src)
2562 hasErr := len(errs.GetErrors()) > 0
2563 if hasErr != tc.E {
2564 b.Fatalf("p.Parse(%q) got error: %v, expected error: %v", tc.I, hasErr, tc.E)
2565 }
2566 }
2567 }
2568 })
2569 }
2570}
2571
2572// BenchmarkParallelByCategory benchmarks parsing concurrently across goroutines by category.
2573func BenchmarkParallelByCategory(b *testing.B) {

Callers

nothing calls this directly

Calls 4

NewTextSourceFunction · 0.92
GetErrorsMethod · 0.80
ParseMethod · 0.65

Tested by

no test coverage detected