diff options
author | 2017-11-19 21:10:04 -0800 | |
---|---|---|
committer | 2017-11-19 22:01:46 -0800 | |
commit | 8ffb773f43c8dc54801ca1d111854e7e881c93c9 (patch) | |
tree | 38133a2fc612597a75fed1d13e5b4042f58a2b7e /vendor/github.com/tdewolff/minify/benchmarks/html_test.go |
First commit
Diffstat (limited to 'vendor/github.com/tdewolff/minify/benchmarks/html_test.go')
-rw-r--r-- | vendor/github.com/tdewolff/minify/benchmarks/html_test.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/github.com/tdewolff/minify/benchmarks/html_test.go b/vendor/github.com/tdewolff/minify/benchmarks/html_test.go new file mode 100644 index 0000000..d26b86d --- /dev/null +++ b/vendor/github.com/tdewolff/minify/benchmarks/html_test.go @@ -0,0 +1,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) + } + }) + } +} |