Skip to content

Commit 188830c

Browse files
authored
Merge pull request #15 from timonwong/update-benchmark
Update benchmark (go1.13)
2 parents b923c6b + e7467cc commit 188830c

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,28 +64,29 @@ Comparision with the standard library `time.(*Time).Format()`:
6464
goos: darwin
6565
goarch: amd64
6666
pkg: github.com/imperfectgo/go-strftime
67-
BenchmarkStdTimeFormat-4 5000000 356 ns/op 48 B/op 1 allocs/op
68-
BenchmarkGoStrftime-4 5000000 347 ns/op 32 B/op 1 allocs/op
67+
BenchmarkStdTimeFormat-4 3844191 315 ns/op 32 B/op 1 allocs/op
68+
BenchmarkGoStrftime-4 4354848 274 ns/op 0 B/op 0 allocs/op
6969
PASS
70-
ok github.com/imperfectgo/go-strftime 4.245s
70+
ok github.com/imperfectgo/go-strftime 3.013s
7171
```
7272

7373
Comparision with other libraries:
7474

7575
```
76-
> go test -tags benchcomp -bench Bench -cpu 8 -benchmem .
76+
> go test -tags benchcomp -bench Bench -cpu 4 -benchmem .
7777
7878
goos: darwin
7979
goarch: amd64
80-
pkg: github.com/imperfectgo/go-strftime/benchmark
81-
BenchmarkImperfectGo-8 3000000 484 ns/op 64 B/op 1 allocs/op
82-
BenchmarkTebeka-8 300000 4161 ns/op 272 B/op 20 allocs/op
83-
BenchmarkJehiah-8 1000000 1719 ns/op 256 B/op 17 allocs/op
84-
BenchmarkFastly-8 2000000 708 ns/op 85 B/op 5 allocs/op
85-
BenchmarkLestrrat-8 1000000 1471 ns/op 240 B/op 3 allocs/op
86-
BenchmarkLestrratCachedString-8 3000000 496 ns/op 128 B/op 2 allocs/op
80+
pkg: github.com/imperfectgo/go-strftime
81+
BenchmarkImperfectGo-4 2713639 445 ns/op 64 B/op 1 allocs/op
82+
BenchmarkImperfectGoNoAlloc-4 3081366 389 ns/op 0 B/op 0 allocs/op
83+
BenchmarkTebeka-4 311500 3930 ns/op 256 B/op 19 allocs/op
84+
BenchmarkJehiah-4 712195 1709 ns/op 256 B/op 17 allocs/op
85+
BenchmarkFastly-4 1934066 615 ns/op 80 B/op 5 allocs/op
86+
BenchmarkLestrrat-4 1000000 1037 ns/op 240 B/op 3 allocs/op
87+
BenchmarkLestrratCachedString-4 2415724 498 ns/op 128 B/op 2 allocs/op
8788
PASS
88-
ok github.com/imperfectgo/go-strftime/benchmark 10.605s
89+
ok github.com/imperfectgo/go-strftime 10.332s
8990
```
9091

9192
## License

benchmark_comp_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ func BenchmarkImperfectGo(b *testing.B) {
2929
}
3030
}
3131

32+
func BenchmarkImperfectGoNoAlloc(b *testing.B) {
33+
var buf [128]byte
34+
for i := 0; i < b.N; i++ {
35+
imperfectgo.AppendFormat(buf[:0], now, benchfmt)
36+
}
37+
}
38+
3239
func BenchmarkTebeka(b *testing.B) {
3340
for i := 0; i < b.N; i++ {
3441
tebeka.Format(benchfmt, now)

0 commit comments

Comments
 (0)