mirror of
https://github.com/golang/go
synced 2024-09-25 01:20:13 -06:00
container/heap: correct number of elements in BenchmarkDup
In BenchmarkDup fuction, heap is created as h := make(myHeap, n) and then n elements are added, so first time there are 2*n elements in heap. Fixes #15380 Change-Id: I0508486a847006b3cd545fd695e8b09af339134f Reviewed-on: https://go-review.googlesource.com/22310 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
001e8e8070
commit
30c278dbe9
@ -173,7 +173,7 @@ func TestRemove2(t *testing.T) {
|
||||
|
||||
func BenchmarkDup(b *testing.B) {
|
||||
const n = 10000
|
||||
h := make(myHeap, n)
|
||||
h := make(myHeap, 0, n)
|
||||
for i := 0; i < b.N; i++ {
|
||||
for j := 0; j < n; j++ {
|
||||
Push(&h, 0) // all elements are the same
|
||||
|
Loading…
Reference in New Issue
Block a user