27 lines
390 B
Go
27 lines
390 B
Go
package token_test
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
|
|
"git.akyoto.dev/cli/q/src/token"
|
|
)
|
|
|
|
func BenchmarkLines(b *testing.B) {
|
|
b.Run("__1", bench(1))
|
|
b.Run("_10", bench(10))
|
|
b.Run("100", bench(100))
|
|
}
|
|
|
|
func bench(n int) func(b *testing.B) {
|
|
line := []byte("hello := 123\n")
|
|
|
|
return func(b *testing.B) {
|
|
input := bytes.Repeat(line, n)
|
|
|
|
for range b.N {
|
|
token.Tokenize(input)
|
|
}
|
|
}
|
|
}
|