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

Function BenchmarkLexer

parser/lexer_test.go:576–590  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

574}
575
576func BenchmarkLexer(b *testing.B) {
577 expr := `a > 5 && b < 10 || c == "xyz" + 42u - 3.14 * (foo.bar(1, 2, [3, ?4]))`
578 buf := runes.NewBuffer(expr)
579 b.ResetTimer()
580 b.ReportAllocs()
581 for i := 0; i < b.N; i++ {
582 lexer := newLexer(buf)
583 for {
584 tok := lexer.Lex()
585 if tok.kind == tokEnd || tok.kind == tokError {
586 break
587 }
588 }
589 }
590}

Callers

nothing calls this directly

Calls 3

NewBufferFunction · 0.92
newLexerFunction · 0.85
LexMethod · 0.80

Tested by

no test coverage detected