The Len method is a linear operation. CL 73090 used Len to iterate over
a ring, resulting in a quadratic time operation.
Change-Id: Ib69c19190ba648311e6c345d8cb26292b50121ee
Reviewed-on: https://go-review.googlesource.com/74390
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Change-Id: I6b16cfcbe824f999c9b64df539deea567e327db7
Reviewed-on: https://go-review.googlesource.com/73090
Reviewed-by: Gabriel Aszalos <gabriel.aszalos@gmail.com>
Reviewed-by: Jason Wangsadinata <jwangsadinata@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Gabriel Aszalos <gabriel.aszalos@gmail.com>
I modified verify() to fail every time to test the change. Before adding
t.Helper() (line 37 is in verify()):
/.../go/src/container/heap/heap_test.go:37: forced failure
FAIL
Afer adding t.Helper() (line 67 is where verify() is called):
/.../go/src/container/heap/heap_test.go:67: forced failure
FAIL
Fixes#21863
Change-Id: I46f0c8ec413cc664358c568fc53e48bb4a1d03d0
Reviewed-on: https://go-review.googlesource.com/63570
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
container/list/list_test.go:274: self-assignment of e1 to e1
container/list/list_test.go:274: self-assignment of e4 to e4
container/list/list_test.go:282: self-assignment of e1 to e1
container/list/list_test.go:286: self-assignment of e1 to e1
container/list/list_test.go:286: self-assignment of e4 to e4
Updates #11041
Change-Id: Ibd90cf6a924e93497908f437b814c3fc82937f4a
Reviewed-on: https://go-review.googlesource.com/27114
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The heap.Fix function calls both down and up. If the element is moved
down, we don't need to call up and we could save a comparison.
(per suggestion by Radu Berinde)
Fixes#16098.
Change-Id: I83a74710e66cf0d274d8c0743338c26f89f31afe
Reviewed-on: https://go-review.googlesource.com/24273
Reviewed-by: Robert Griesemer <gri@golang.org>
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>
The tree's pretty inconsistent about single space vs double space
after a period in documentation. Make it consistently a single space,
per earlier decisions. This means contributors won't be confused by
misleading precedence.
This CL doesn't use go/doc to parse. It only addresses // comments.
It was generated with:
$ perl -i -npe 's,^(\s*// .+[a-z]\.) +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.) +([A-Z])')
$ go test go/doc -update
Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7
Reviewed-on: https://go-review.googlesource.com/20022
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dave Day <djd@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>