mirror of
https://github.com/teivah/100-go-mistakes.git
synced 2026-06-21 00:47:11 +08:00
Double the size of slice in BenchmarkSum2
It's unfair that `BenchmarkLinkedList` iterates n count but `BenchmarkSum2` iterates n/2 count because `i+=2` in `sum2`.
This commit is contained in:
parent
ab425833b5
commit
e4df08796d
1 changed files with 1 additions and 1 deletions
|
|
@ -24,7 +24,7 @@ func BenchmarkSum2(b *testing.B) {
|
|||
var local int64
|
||||
for i := 0; i < b.N; i++ {
|
||||
b.StopTimer()
|
||||
s := make([]int64, n)
|
||||
s := make([]int64, n*2)
|
||||
b.StartTimer()
|
||||
local = sum2(s)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue