(b *testing.B)
| 574 | } |
| 575 | |
| 576 | func 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 | } |