blob: d26b86d1cac8d9f5446e60f15388a0005e88c8ee (
plain)
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
31
32
33
34
35
36
|
package benchmarks
import (
"testing"
"github.com/tdewolff/minify/html"
)
var htmlSamples = []string{
"sample_amazon.html",
"sample_bbc.html",
"sample_blogpost.html",
"sample_es6.html",
"sample_stackoverflow.html",
"sample_wikipedia.html",
}
func init() {
for _, sample := range htmlSamples {
load(sample)
}
}
func BenchmarkHTML(b *testing.B) {
for _, sample := range htmlSamples {
b.Run(sample, func(b *testing.B) {
b.SetBytes(int64(r[sample].Len()))
for i := 0; i < b.N; i++ {
r[sample].Reset()
w[sample].Reset()
html.Minify(m, w[sample], r[sample], nil)
}
})
}
}
|