1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-12 20:27:30 +08:00

Added parser benchmark

This commit is contained in:
wolfgarnet 2016-01-11 13:37:07 +01:00
parent f304d96c25
commit fa2636115f

View File

@ -8,6 +8,7 @@ import (
"github.com/robertkrimen/otto/ast"
"github.com/robertkrimen/otto/file"
"github.com/robertkrimen/otto/underscore"
)
func firstErr(err error) error {
@ -1005,3 +1006,13 @@ func TestPosition(t *testing.T) {
is(node.(*ast.FunctionLiteral).Source, "function(){ return abc; }")
})
}
func BenchmarkParser(b *testing.B) {
src := underscore.Source()
b.ResetTimer()
for i := 0; i < b.N; i++ {
parser := newParser("", src)
parser.parse()
}
}