diff --git a/bench/bench_test.go b/bench/bench_test.go index 174ddaf..00dd3fc 100644 --- a/bench/bench_test.go +++ b/bench/bench_test.go @@ -11,6 +11,7 @@ import ( fastly "github.com/fastly/go-utils/strftime" jehiah "github.com/jehiah/go-strftime" lestrrat "github.com/lestrrat-go/strftime" + ncruces "github.com/ncruces/go-strftime" tebeka "github.com/tebeka/strftime" ) @@ -44,6 +45,21 @@ func BenchmarkFastly(b *testing.B) { } } +func BenchmarkNcruces(b *testing.B) { + var t time.Time + for i := 0; i < b.N; i++ { + ncruces.Format(benchfmt, t) + } +} + +func BenchmarkNcrucesAppend(b *testing.B) { + var d []byte + var t time.Time + for i := 0; i < b.N; i++ { + d = ncruces.AppendFormat(d[:0], benchfmt, t) + } +} + func BenchmarkLestrrat(b *testing.B) { var t time.Time for i := 0; i < b.N; i++ { diff --git a/bench/go.mod b/bench/go.mod index fa24e22..b8a86a6 100644 --- a/bench/go.mod +++ b/bench/go.mod @@ -5,6 +5,7 @@ go 1.16 require ( github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 - github.com/lestrrat-go/strftime v1.0.3 + github.com/lestrrat-go/strftime v1.0.6 + github.com/ncruces/go-strftime v0.1.9 github.com/tebeka/strftime v0.1.5 )