mirror of
https://github.com/robertkrimen/otto
synced 2025-10-12 20:27:30 +08:00
Added parser benchmark
This commit is contained in:
parent
f304d96c25
commit
fa2636115f
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user