1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
package sourcemap_test
import (
"testing"
"github.com/go-sourcemap/sourcemap"
)
func BenchmarkParse(b *testing.B) {
for i := 0; i < b.N; i++ {
_, err := sourcemap.Parse(jqSourceMapURL, jqSourceMapBytes)
if err != nil {
b.Fatal(err)
}
}
}
func BenchmarkSource(b *testing.B) {
smap, err := sourcemap.Parse(jqSourceMapURL, jqSourceMapBytes)
if err != nil {
b.Fatal(err)
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
for j := 0; j < 10; j++ {
smap.Source(j, 100*j)
}
}
}
|