diff options
author | Jamil Djadala <djadala@gmail.com> | 2016-04-20 09:08:28 +0300 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2016-04-20 15:26:05 +0000 |
commit | 30c278dbe907111b51737adb8ba0a9e1956f3ed5 (patch) | |
tree | c4813c4de7fd2917086104e54d6bcb4833be3e41 /src/container | |
parent | 001e8e8070e8ed3a578dbad93cc3f70257e965bd (diff) | |
download | go-30c278dbe907111b51737adb8ba0a9e1956f3ed5.tar.gz go-30c278dbe907111b51737adb8ba0a9e1956f3ed5.zip |
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>
Diffstat (limited to 'src/container')
-rw-r--r-- | src/container/heap/heap_test.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/container/heap/heap_test.go b/src/container/heap/heap_test.go index b3d054c5f3..d41110422e 100644 --- a/src/container/heap/heap_test.go +++ b/src/container/heap/heap_test.go @@ -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 |