Skip to content

Instantly share code, notes, and snippets.

@arschles
Last active October 11, 2015 05:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arschles/ef4b5a9bf296f1d6d994 to your computer and use it in GitHub Desktop.
Save arschles/ef4b5a9bf296f1d6d994 to your computer and use it in GitHub Desktop.
golang html/template Parse benchmark
package tmplbench
import (
"testing"
"html/template"
)
func BenchmarkTemplate(b *testing.B) {
tmpl := template.New("test")
b.ResetTimer()
for i := 0; i < b.N; i++ {
tmpl.Parse("Hello, {{.}}!")
}
}
@arschles
Copy link
Author

arschles commented Dec 4, 2014

benchmark test:

% go test -bench ./...
ok      github.com/arschles/go-http-handler 0.006s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment