File: bench_test.go

package info (click to toggle)
golang-gopkg-sourcemap.v1 1.0.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 128 kB
  • sloc: makefile: 6
file content (30 lines) | stat: -rw-r--r-- 486 bytes parent folder | download
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"

	"gopkg.in/sourcemap.v1"
)

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)
		}
	}
}