Skip to content

Commit

Permalink
Fix benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed Jan 24, 2022
1 parent 09facfc commit 5d2c70b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
goos: windows
goarch: amd64
pkg: github.com/mattn/go-generics-example/benchmark
cpu: AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx
BenchmarkWithoutGenerics-8 50832379 21.95 ns/op
BenchmarkWithGenerics-8 59158761 21.23 ns/op
BenchmarkWithInterface-8 59304652 21.44 ns/op
cpu: AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx
BenchmarkWithoutGenerics-8 53993007 20.37 ns/op
BenchmarkWithGenerics-8 69206546 20.98 ns/op
BenchmarkWithInterface-8 54277022 21.20 ns/op
PASS
ok github.com/mattn/go-generics-example/benchmark 3.754s
ok github.com/mattn/go-generics-example/benchmark 4.692s
```
4 changes: 2 additions & 2 deletions benchmark/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func addInterface(a, b interface{}) interface{} {

func BenchmarkWithInterface(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = addInterface(1, 2)
_ = addInterface("foo", "bar")
_ = addInterface(1, 2).(int)
_ = addInterface("foo", "bar").(string)
}
}

0 comments on commit 5d2c70b

Please sign in to comment.