13 jehiah "github.com/jehiah/go-strftime"
14 fastly "github.com/fastly/go-utils/strftime"
15 lestrrat "github.com/lestrrat-go/strftime"
16 tebeka "github.com/tebeka/strftime"
21 log.Println(http.ListenAndServe("localhost:8080", nil))
25 const benchfmt = `%A %a %B %b %d %H %I %M %m %p %S %Y %y %Z`
27 func BenchmarkTebeka(b *testing.B) {
29 for i := 0; i < b.N; i++ {
30 tebeka.Format(benchfmt, t)
34 func BenchmarkJehiah(b *testing.B) {
35 // Grr, uses byte slices, and does it faster, but with more allocs
37 for i := 0; i < b.N; i++ {
38 jehiah.Format(benchfmt, t)
42 func BenchmarkFastly(b *testing.B) {
44 for i := 0; i < b.N; i++ {
45 fastly.Strftime(benchfmt, t)
49 func BenchmarkLestrrat(b *testing.B) {
51 for i := 0; i < b.N; i++ {
52 lestrrat.Format(benchfmt, t)
56 func BenchmarkLestrratCachedString(b *testing.B) {
58 f, _ := lestrrat.New(benchfmt)
59 // This benchmark does not take into effect the compilation time
60 for i := 0; i < b.N; i++ {
65 func BenchmarkLestrratCachedWriter(b *testing.B) {
67 f, _ := lestrrat.New(benchfmt)
71 // This benchmark does not take into effect the compilation time
72 // nor the buffer reset time
73 for i := 0; i < b.N; i++ {