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