Age | Commit message (Collapse) | Author |
|
This CL changes some unit test functions, making sure that these tests (and goroutines spawned during test) won't block.
Since they are just test functions, I use one CL to fix them all. I hope this won't cause trouble to reviewers and can save time for us.
There are three main categories of incorrect logic fixed by this CL:
1. Use testing.Fatal()/Fatalf() in spawned goroutines, which is forbidden by Go's document.
2. Channels are used in such a way that, when errors or timeout happen, the test will be blocked and never return.
3. Channels are used in such a way that, when errors or timeout happen, the test can return but some spawned goroutines will be leaked, occupying resource until all other tests return and the process is killed.
Change-Id: I3df931ec380794a0cf1404e632c1dd57c65d63e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/219380
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: I932de9bb061a8ba3332ef03207983e8b98d6f1e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/187918
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
|
The existing implementation has poor performance for inserting large
number of keys because it chooses to append the new key to the sorted
keys array and then sort the new array again (time complexity is
O(nlogn)).
The improvement tries to utilize the sorted keys array by searching the
index and doing an insertion if any (time complexity is O(logn)).
Benchmarked on 4-core machine with `go test -cpu 1,2,4,8 -count 5
-benchmem -bench=.`(the equal results are omitted):
name old time/op new time/op delta
MapAddDifferentRandom-8 408µs ±11% 69µs ± 3% -82.95% (p=0.008 n=5+5)
MapAddDifferentRandom-4 389µs ±19% 69µs ± 2% -82.28% (p=0.008 n=5+5)
MapAddDifferentRandom-2 365µs ± 4% 75µs ± 6% -79.51% (p=0.008 n=5+5)
MapSetDifferentRandom-8 365µs ± 4% 76µs ±40% -79.07% (p=0.008 n=5+5)
MapAddDifferentRandom 366µs ± 3% 78µs ± 6% -78.66% (p=0.008 n=5+5)
MapSetDifferentRandom 369µs ± 2% 81µs ±34% -77.99% (p=0.008 n=5+5)
MapSetDifferentRandom-2 378µs ±10% 100µs ±32% -73.47% (p=0.008 n=5+5)
MapSetDifferentRandom-4 352µs ± 4% 108µs ± 7% -69.40% (p=0.008 n=5+5)
IntAdd-2 23.1ns ±21% 15.5ns ±23% -32.79% (p=0.032 n=5+5)
IntSet-2 21.4ns ±14% 16.7ns ±17% -22.00% (p=0.016 n=5+5)
FloatAdd-8 88.8ns ± 9% 70.8ns ±25% -20.23% (p=0.024 n=5+5)
FloatSet-2 22.3ns ±15% 17.8ns ±14% -20.14% (p=0.008 n=5+5)
IntAdd-8 21.7ns ± 3% 18.7ns ± 4% -14.00% (p=0.008 n=5+5)
MapAddDifferent-8 1.58µs ± 7% 1.42µs ± 6% -10.06% (p=0.016 n=5+5)
StringSet-2 42.4ns ± 1% 43.7ns ± 5% +3.07% (p=0.048 n=4+5)
FloatSet 8.27ns ± 2% 8.60ns ± 1% +3.94% (p=0.008 n=5+5)
FloatAdd 12.5ns ± 2% 13.0ns ± 4% +4.33% (p=0.032 n=5+5)
MapSetString-4 94.6ns ± 0% 101.7ns ± 4% +7.55% (p=0.016 n=4+5)
MapAddSameSteadyState-2 34.9ns ± 3% 37.7ns ± 5% +8.14% (p=0.008 n=5+5)
StringSet-4 34.5ns ± 0% 37.6ns ± 9% +9.02% (p=0.016 n=4+5)
MapSetDifferent-8 377ns ± 3% 411ns ± 7% +9.07% (p=0.008 n=5+5)
MapAddSameSteadyState 39.1ns ± 2% 42.8ns ± 6% +9.36% (p=0.008 n=5+5)
MapAddDifferentSteadyState 172ns ± 4% 190ns ± 9% +10.96% (p=0.016 n=5+5)
MapSet 143ns ± 4% 159ns ± 2% +11.06% (p=0.008 n=5+5)
MapSet-4 96.9ns ± 5% 107.8ns ± 6% +11.25% (p=0.008 n=5+5)
MapSet-2 102ns ± 6% 114ns ± 8% +11.94% (p=0.008 n=5+5)
IntSet 8.18ns ± 1% 12.78ns ±13% +56.31% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
MapSetDifferentRandom-4 19.8kB ± 0% 16.6kB ± 0% -16.21% (p=0.008 n=5+5)
MapSetDifferentRandom 19.8kB ± 0% 16.6kB ± 0% -16.21% (p=0.008 n=5+5)
MapSetDifferentRandom-8 19.8kB ± 0% 16.6kB ± 0% -16.20% (p=0.008 n=5+5)
MapSetDifferentRandom-2 19.8kB ± 0% 16.6kB ± 0% -16.20% (p=0.008 n=5+5)
MapAddDifferentRandom 20.6kB ± 0% 17.4kB ± 0% -15.57% (p=0.008 n=5+5)
MapAddDifferentRandom-8 20.6kB ± 0% 17.4kB ± 0% -15.57% (p=0.008 n=5+5)
MapAddDifferentRandom-2 20.6kB ± 0% 17.4kB ± 0% -15.56% (p=0.008 n=5+5)
MapAddDifferentRandom-4 20.6kB ± 0% 17.4kB ± 0% -15.56% (p=0.008 n=5+5)
MapAddDifferent 1.09kB ± 0% 0.96kB ± 0% -11.76% (p=0.008 n=5+5)
MapAddDifferent-2 1.09kB ± 0% 0.96kB ± 0% -11.76% (p=0.008 n=5+5)
MapAddDifferent-4 1.09kB ± 0% 0.96kB ± 0% -11.76% (p=0.008 n=5+5)
MapAddDifferent-8 1.09kB ± 0% 0.96kB ± 0% -11.76% (p=0.008 n=5+5)
MapAddSame 480B ± 0% 448B ± 0% -6.67% (p=0.008 n=5+5)
MapAddSame-2 480B ± 0% 448B ± 0% -6.67% (p=0.008 n=5+5)
MapAddSame-4 480B ± 0% 448B ± 0% -6.67% (p=0.008 n=5+5)
MapAddSame-8 480B ± 0% 448B ± 0% -6.67% (p=0.008 n=5+5)
name old allocs/op new allocs/op delta
MapSetDifferentRandom 423 ± 0% 323 ± 0% -23.64% (p=0.008 n=5+5)
MapSetDifferentRandom-2 423 ± 0% 323 ± 0% -23.64% (p=0.008 n=5+5)
MapSetDifferentRandom-4 423 ± 0% 323 ± 0% -23.64% (p=0.008 n=5+5)
MapSetDifferentRandom-8 423 ± 0% 323 ± 0% -23.64% (p=0.008 n=5+5)
MapAddDifferentRandom 523 ± 0% 423 ± 0% -19.12% (p=0.008 n=5+5)
MapAddDifferentRandom-2 523 ± 0% 423 ± 0% -19.12% (p=0.008 n=5+5)
MapAddDifferentRandom-4 523 ± 0% 423 ± 0% -19.12% (p=0.008 n=5+5)
MapAddDifferentRandom-8 523 ± 0% 423 ± 0% -19.12% (p=0.008 n=5+5)
MapAddDifferent 31.0 ± 0% 27.0 ± 0% -12.90% (p=0.008 n=5+5)
MapAddDifferent-2 31.0 ± 0% 27.0 ± 0% -12.90% (p=0.008 n=5+5)
MapAddDifferent-4 31.0 ± 0% 27.0 ± 0% -12.90% (p=0.008 n=5+5)
MapAddDifferent-8 31.0 ± 0% 27.0 ± 0% -12.90% (p=0.008 n=5+5)
MapAddSame 11.0 ± 0% 10.0 ± 0% -9.09% (p=0.008 n=5+5)
MapAddSame-2 11.0 ± 0% 10.0 ± 0% -9.09% (p=0.008 n=5+5)
MapAddSame-4 11.0 ± 0% 10.0 ± 0% -9.09% (p=0.008 n=5+5)
MapAddSame-8 11.0 ± 0% 10.0 ± 0% -9.09% (p=0.008 n=5+5)
Fixes #31414
Change-Id: I2dd655dec9dbbf8d7881a0f3f8edcb3d29199a48
GitHub-Last-Rev: a816fe3f62498481500a0ce9695de9fd3aa9f7b7
GitHub-Pull-Request: golang/go#31418
Reviewed-on: https://go-review.googlesource.com/c/go/+/171718
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
|
|
Fixes #13491
Change-Id: Ic0525d8ee90f47d0d23c1485919aee13d2400494
Reviewed-on: https://go-review.googlesource.com/c/139537
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: Ibc40237981fdd20316f73f7f6f3dfa918dd0af5d
Reviewed-on: https://go-review.googlesource.com/133658
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
|
|
I grepped for "bytes.Buffer" and "buf.String" and mostly ignored test
files. I skipped a few on purpose and probably missed a few others,
but otherwise I think this should be most of them.
Updates #18990
Change-Id: I5a6ae4296b87b416d8da02d7bfaf981d8cc14774
Reviewed-on: https://go-review.googlesource.com/102479
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
fixes #21619
Change-Id: I5bb513dfc8cac875b06a262eec40b5863ae23a4c
Reviewed-on: https://go-review.googlesource.com/62370
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
|
Use Load instead of LoadOrStore in the fast path to save 1 alloc/op
for existing keys.
name old time/op new time/op delta
IntAdd 6.39ns ± 7% 6.97ns ±19% ~ (p=0.105 n=8+8)
IntAdd-6 12.3ns ± 1% 12.2ns ± 1% ~ (p=0.396 n=7+7)
IntSet 6.41ns ± 6% 6.94ns ±21% ~ (p=0.168 n=8+8)
IntSet-6 12.1ns ± 3% 11.7ns ± 9% ~ (p=0.496 n=7+8)
FloatAdd 14.3ns ± 9% 14.7ns ± 4% ~ (p=0.088 n=8+8)
FloatAdd-6 36.5ns ± 1% 36.6ns ± 0% ~ (p=0.709 n=7+6)
FloatSet 6.59ns ± 7% 6.47ns ± 7% ~ (p=0.397 n=8+7)
FloatSet-6 12.2ns ± 1% 12.2ns ± 2% ~ (p=0.748 n=7+7)
StringSet 67.8ns ± 6% 68.7ns ± 6% ~ (p=0.342 n=8+8)
StringSet-6 41.8ns ± 5% 41.7ns ± 5% ~ (p=0.979 n=8+8)
MapSet 294ns ± 6% 234ns ± 4% -20.35% (p=0.000 n=8+8)
MapSet-6 95.8ns ± 2% 89.4ns ± 3% -6.73% (p=0.000 n=8+8)
MapSetDifferent 1.31µs ± 5% 1.07µs ± 4% -18.21% (p=0.000 n=8+8)
MapSetDifferent-6 260ns ± 8% 210ns ± 9% -19.44% (p=0.000 n=8+8)
MapSetString 294ns ± 6% 236ns ± 4% -19.92% (p=0.000 n=8+8)
MapSetString-6 95.6ns ± 2% 89.9ns ± 2% -5.97% (p=0.000 n=7+8)
MapAddSame 1.46µs ± 3% 1.46µs ± 5% ~ (p=0.721 n=8+8)
MapAddSame-6 328ns ± 6% 330ns ± 4% ~ (p=0.776 n=8+8)
MapAddDifferent 4.89µs ± 7% 4.98µs ± 6% ~ (p=0.505 n=8+8)
MapAddDifferent-6 1.02µs ± 3% 1.01µs ± 4% ~ (p=0.352 n=7+8)
MapAddSameSteadyState 62.1ns ± 7% 60.8ns ± 4% ~ (p=0.521 n=8+8)
MapAddSameSteadyState-6 38.1ns ± 3% 37.7ns ± 0% ~ (p=0.185 n=7+6)
MapAddDifferentSteadyState 290ns ± 5% 293ns ± 4% ~ (p=0.515 n=8+8)
MapAddDifferentSteadyState-6 63.0ns ± 7% 63.7ns ±11% ~ (p=0.482 n=7+8)
RealworldExpvarUsage 7.39µs ± 5% 7.51µs ± 5% ~ (p=0.382 n=8+8)
RealworldExpvarUsage-6 3.07µs ±28% 3.04µs ±43% ~ (p=0.798 n=8+8)
name old alloc/op new alloc/op delta
IntAdd 0.00B 0.00B ~ (all equal)
IntAdd-6 0.00B 0.00B ~ (all equal)
IntSet 0.00B 0.00B ~ (all equal)
IntSet-6 0.00B 0.00B ~ (all equal)
FloatAdd 0.00B 0.00B ~ (all equal)
FloatAdd-6 0.00B 0.00B ~ (all equal)
FloatSet 0.00B 0.00B ~ (all equal)
FloatSet-6 0.00B 0.00B ~ (all equal)
StringSet 16.0B ± 0% 16.0B ± 0% ~ (all equal)
StringSet-6 16.0B ± 0% 16.0B ± 0% ~ (all equal)
MapSet 48.0B ± 0% 32.0B ± 0% -33.33% (p=0.000 n=8+8)
MapSet-6 48.0B ± 0% 32.0B ± 0% -33.33% (p=0.000 n=8+8)
MapSetDifferent 192B ± 0% 128B ± 0% -33.33% (p=0.000 n=8+8)
MapSetDifferent-6 192B ± 0% 128B ± 0% -33.33% (p=0.000 n=8+8)
MapSetString 48.0B ± 0% 32.0B ± 0% -33.33% (p=0.000 n=8+8)
MapSetString-6 48.0B ± 0% 32.0B ± 0% -33.33% (p=0.000 n=8+8)
MapAddSame 480B ± 0% 480B ± 0% ~ (all equal)
MapAddSame-6 480B ± 0% 480B ± 0% ~ (all equal)
MapAddDifferent 1.09kB ± 0% 1.09kB ± 0% ~ (all equal)
MapAddDifferent-6 1.09kB ± 0% 1.09kB ± 0% ~ (all equal)
MapAddSameSteadyState 0.00B 0.00B ~ (all equal)
MapAddSameSteadyState-6 0.00B 0.00B ~ (all equal)
MapAddDifferentSteadyState 0.00B 0.00B ~ (all equal)
MapAddDifferentSteadyState-6 0.00B 0.00B ~ (all equal)
RealworldExpvarUsage 0.00B 0.00B ~ (all equal)
RealworldExpvarUsage-6 0.00B 0.00B ~ (all equal)
name old allocs/op new allocs/op delta
IntAdd 0.00 0.00 ~ (all equal)
IntAdd-6 0.00 0.00 ~ (all equal)
IntSet 0.00 0.00 ~ (all equal)
IntSet-6 0.00 0.00 ~ (all equal)
FloatAdd 0.00 0.00 ~ (all equal)
FloatAdd-6 0.00 0.00 ~ (all equal)
FloatSet 0.00 0.00 ~ (all equal)
FloatSet-6 0.00 0.00 ~ (all equal)
StringSet 1.00 ± 0% 1.00 ± 0% ~ (all equal)
StringSet-6 1.00 ± 0% 1.00 ± 0% ~ (all equal)
MapSet 3.00 ± 0% 2.00 ± 0% -33.33% (p=0.000 n=8+8)
MapSet-6 3.00 ± 0% 2.00 ± 0% -33.33% (p=0.000 n=8+8)
MapSetDifferent 12.0 ± 0% 8.0 ± 0% -33.33% (p=0.000 n=8+8)
MapSetDifferent-6 12.0 ± 0% 8.0 ± 0% -33.33% (p=0.000 n=8+8)
MapSetString 3.00 ± 0% 2.00 ± 0% -33.33% (p=0.000 n=8+8)
MapSetString-6 3.00 ± 0% 2.00 ± 0% -33.33% (p=0.000 n=8+8)
MapAddSame 11.0 ± 0% 11.0 ± 0% ~ (all equal)
MapAddSame-6 11.0 ± 0% 11.0 ± 0% ~ (all equal)
MapAddDifferent 31.0 ± 0% 31.0 ± 0% ~ (all equal)
MapAddDifferent-6 31.0 ± 0% 31.0 ± 0% ~ (all equal)
MapAddSameSteadyState 0.00 0.00 ~ (all equal)
MapAddSameSteadyState-6 0.00 0.00 ~ (all equal)
MapAddDifferentSteadyState 0.00 0.00 ~ (all equal)
MapAddDifferentSteadyState-6 0.00 0.00 ~ (all equal)
RealworldExpvarUsage 0.00 0.00 ~ (all equal)
RealworldExpvarUsage-6 0.00 0.00 ~ (all equal)
https://perf.golang.org/search?q=upload:20170501.1
Change-Id: I28fc3906473f2b7307f6d1ae05a8d9b01ef8a6f8
Reviewed-on: https://go-review.googlesource.com/42211
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
|
|
Int and Float already used atomics.
When many goroutines on many CPUs concurrently update a StringSet or a
Map with different keys per goroutine, this change results in dramatic
steady-state speedups.
This change does add some overhead for single-CPU and ephemeral maps.
I believe that is mostly due to an increase in allocations per call
(to pack the map keys and values into interface{} values that may
escape into the heap). With better inlining and/or escape analysis,
the single-CPU penalty may decline somewhat.
There are still two RWMutexes in the package: one for the keys in the
global "vars" map, and one for the keys in individual Map variables.
Those RWMutexes could also be eliminated, but avoiding excessive
allocations when adding new keys would require care. The remaining
RWMutexes are only acquired in Do functions, which I believe are not
typically on the fast path.
updates #17973
updates #18177
name old time/op new time/op delta
StringSet 65.9ns ± 8% 55.7ns ± 1% -15.46% (p=0.000 n=8+7)
StringSet-6 416ns ±22% 127ns ±19% -69.37% (p=0.000 n=8+8)
StringSet-48 309ns ± 8% 94ns ± 3% -69.43% (p=0.001 n=7+7)
name old alloc/op new alloc/op delta
StringSet 0.00B 16.00B ± 0% +Inf% (p=0.000 n=8+8)
StringSet-6 0.00B 16.00B ± 0% +Inf% (p=0.000 n=8+8)
StringSet-48 0.00B 16.00B ± 0% +Inf% (p=0.000 n=8+8)
name old allocs/op new allocs/op delta
StringSet 0.00 1.00 ± 0% +Inf% (p=0.000 n=8+8)
StringSet-6 0.00 1.00 ± 0% +Inf% (p=0.000 n=8+8)
StringSet-48 0.00 1.00 ± 0% +Inf% (p=0.000 n=8+8)
https://perf.golang.org/search?q=upload:20170427.3
name old time/op new time/op delta
IntAdd 5.64ns ± 3% 5.58ns ± 1% ~ (p=0.185 n=8+8)
IntAdd-6 18.6ns ±32% 21.4ns ±21% ~ (p=0.078 n=8+8)
IntAdd-48 19.6ns ±13% 20.6ns ±19% ~ (p=0.702 n=8+8)
IntSet 5.50ns ± 1% 5.48ns ± 0% ~ (p=0.222 n=7+8)
IntSet-6 18.5ns ±16% 20.4ns ±30% ~ (p=0.314 n=8+8)
IntSet-48 19.7ns ±12% 20.4ns ±16% ~ (p=0.522 n=8+8)
FloatAdd 14.5ns ± 1% 14.6ns ± 2% ~ (p=0.237 n=7+8)
FloatAdd-6 69.9ns ±13% 68.4ns ± 7% ~ (p=0.557 n=7+7)
FloatAdd-48 110ns ± 9% 109ns ± 6% ~ (p=0.667 n=8+8)
FloatSet 7.62ns ± 3% 7.64ns ± 5% ~ (p=0.939 n=8+8)
FloatSet-6 20.7ns ±22% 21.0ns ±23% ~ (p=0.959 n=8+8)
FloatSet-48 20.4ns ±24% 20.8ns ±19% ~ (p=0.899 n=8+8)
MapSet 88.1ns ±15% 200.9ns ± 7% +128.11% (p=0.000 n=8+8)
MapSet-6 453ns ±12% 202ns ± 8% -55.43% (p=0.000 n=8+8)
MapSet-48 432ns ±12% 240ns ±15% -44.49% (p=0.000 n=8+8)
MapSetDifferent 349ns ± 1% 876ns ± 2% +151.08% (p=0.001 n=6+7)
MapSetDifferent-6 1.74µs ±32% 0.25µs ±17% -85.71% (p=0.000 n=8+8)
MapSetDifferent-48 1.77µs ±10% 0.14µs ± 2% -91.84% (p=0.000 n=8+8)
MapSetString 88.1ns ± 7% 205.3ns ± 5% +132.98% (p=0.001 n=7+7)
MapSetString-6 438ns ±30% 205ns ± 9% -53.15% (p=0.000 n=8+8)
MapSetString-48 419ns ±14% 241ns ±15% -42.39% (p=0.000 n=8+8)
MapAddSame 686ns ± 9% 1010ns ± 5% +47.41% (p=0.000 n=8+8)
MapAddSame-6 238ns ±10% 300ns ±11% +26.22% (p=0.000 n=8+8)
MapAddSame-48 366ns ± 4% 483ns ± 3% +32.06% (p=0.000 n=8+8)
MapAddDifferent 1.96µs ± 4% 3.24µs ± 6% +65.58% (p=0.000 n=8+8)
MapAddDifferent-6 553ns ± 3% 948ns ± 8% +71.43% (p=0.000 n=7+8)
MapAddDifferent-48 548ns ± 4% 1242ns ±10% +126.81% (p=0.000 n=8+8)
MapAddSameSteadyState 31.5ns ± 7% 41.7ns ± 6% +32.61% (p=0.000 n=8+8)
MapAddSameSteadyState-6 239ns ± 7% 101ns ±30% -57.53% (p=0.000 n=7+8)
MapAddSameSteadyState-48 152ns ± 4% 85ns ±13% -43.84% (p=0.000 n=8+7)
MapAddDifferentSteadyState 151ns ± 5% 177ns ± 1% +17.32% (p=0.001 n=8+6)
MapAddDifferentSteadyState-6 861ns ±15% 62ns ±23% -92.85% (p=0.000 n=8+8)
MapAddDifferentSteadyState-48 617ns ± 2% 20ns ±14% -96.75% (p=0.000 n=8+8)
RealworldExpvarUsage 4.33µs ± 4% 4.48µs ± 6% ~ (p=0.336 n=8+7)
RealworldExpvarUsage-6 2.12µs ±20% 2.28µs ±10% ~ (p=0.228 n=8+6)
RealworldExpvarUsage-48 1.23µs ±19% 1.36µs ±16% ~ (p=0.152 n=7+8)
name old alloc/op new alloc/op delta
IntAdd 0.00B 0.00B ~ (all equal)
IntAdd-6 0.00B 0.00B ~ (all equal)
IntAdd-48 0.00B 0.00B ~ (all equal)
IntSet 0.00B 0.00B ~ (all equal)
IntSet-6 0.00B 0.00B ~ (all equal)
IntSet-48 0.00B 0.00B ~ (all equal)
FloatAdd 0.00B 0.00B ~ (all equal)
FloatAdd-6 0.00B 0.00B ~ (all equal)
FloatAdd-48 0.00B 0.00B ~ (all equal)
FloatSet 0.00B 0.00B ~ (all equal)
FloatSet-6 0.00B 0.00B ~ (all equal)
FloatSet-48 0.00B 0.00B ~ (all equal)
MapSet 0.00B 48.00B ± 0% +Inf% (p=0.000 n=8+8)
MapSet-6 0.00B 48.00B ± 0% +Inf% (p=0.000 n=8+8)
MapSet-48 0.00B 48.00B ± 0% +Inf% (p=0.000 n=8+8)
MapSetDifferent 0.00B 192.00B ± 0% +Inf% (p=0.000 n=8+8)
MapSetDifferent-6 0.00B 192.00B ± 0% +Inf% (p=0.000 n=8+8)
MapSetDifferent-48 0.00B 192.00B ± 0% +Inf% (p=0.000 n=8+8)
MapSetString 0.00B 48.00B ± 0% +Inf% (p=0.000 n=8+8)
MapSetString-6 0.00B 48.00B ± 0% +Inf% (p=0.000 n=8+8)
MapSetString-48 0.00B 48.00B ± 0% +Inf% (p=0.000 n=8+8)
MapAddSame 456B ± 0% 480B ± 0% +5.26% (p=0.000 n=8+8)
MapAddSame-6 456B ± 0% 480B ± 0% +5.26% (p=0.000 n=8+8)
MapAddSame-48 456B ± 0% 480B ± 0% +5.26% (p=0.000 n=8+8)
MapAddDifferent 672B ± 0% 1088B ± 0% +61.90% (p=0.000 n=8+8)
MapAddDifferent-6 672B ± 0% 1088B ± 0% +61.90% (p=0.000 n=8+8)
MapAddDifferent-48 672B ± 0% 1088B ± 0% +61.90% (p=0.000 n=8+8)
MapAddSameSteadyState 0.00B 0.00B ~ (all equal)
MapAddSameSteadyState-6 0.00B 0.00B ~ (all equal)
MapAddSameSteadyState-48 0.00B 0.00B ~ (all equal)
MapAddDifferentSteadyState 0.00B 0.00B ~ (all equal)
MapAddDifferentSteadyState-6 0.00B 0.00B ~ (all equal)
MapAddDifferentSteadyState-48 0.00B 0.00B ~ (all equal)
RealworldExpvarUsage 0.00B 0.00B ~ (all equal)
RealworldExpvarUsage-6 0.00B 0.00B ~ (all equal)
RealworldExpvarUsage-48 0.00B 0.00B ~ (all equal)
name old allocs/op new allocs/op delta
IntAdd 0.00 0.00 ~ (all equal)
IntAdd-6 0.00 0.00 ~ (all equal)
IntAdd-48 0.00 0.00 ~ (all equal)
IntSet 0.00 0.00 ~ (all equal)
IntSet-6 0.00 0.00 ~ (all equal)
IntSet-48 0.00 0.00 ~ (all equal)
FloatAdd 0.00 0.00 ~ (all equal)
FloatAdd-6 0.00 0.00 ~ (all equal)
FloatAdd-48 0.00 0.00 ~ (all equal)
FloatSet 0.00 0.00 ~ (all equal)
FloatSet-6 0.00 0.00 ~ (all equal)
FloatSet-48 0.00 0.00 ~ (all equal)
MapSet 0.00 3.00 ± 0% +Inf% (p=0.000 n=8+8)
MapSet-6 0.00 3.00 ± 0% +Inf% (p=0.000 n=8+8)
MapSet-48 0.00 3.00 ± 0% +Inf% (p=0.000 n=8+8)
MapSetDifferent 0.00 12.00 ± 0% +Inf% (p=0.000 n=8+8)
MapSetDifferent-6 0.00 12.00 ± 0% +Inf% (p=0.000 n=8+8)
MapSetDifferent-48 0.00 12.00 ± 0% +Inf% (p=0.000 n=8+8)
MapSetString 0.00 3.00 ± 0% +Inf% (p=0.000 n=8+8)
MapSetString-6 0.00 3.00 ± 0% +Inf% (p=0.000 n=8+8)
MapSetString-48 0.00 3.00 ± 0% +Inf% (p=0.000 n=8+8)
MapAddSame 6.00 ± 0% 11.00 ± 0% +83.33% (p=0.000 n=8+8)
MapAddSame-6 6.00 ± 0% 11.00 ± 0% +83.33% (p=0.000 n=8+8)
MapAddSame-48 6.00 ± 0% 11.00 ± 0% +83.33% (p=0.000 n=8+8)
MapAddDifferent 14.0 ± 0% 31.0 ± 0% +121.43% (p=0.000 n=8+8)
MapAddDifferent-6 14.0 ± 0% 31.0 ± 0% +121.43% (p=0.000 n=8+8)
MapAddDifferent-48 14.0 ± 0% 31.0 ± 0% +121.43% (p=0.000 n=8+8)
MapAddSameSteadyState 0.00 0.00 ~ (all equal)
MapAddSameSteadyState-6 0.00 0.00 ~ (all equal)
MapAddSameSteadyState-48 0.00 0.00 ~ (all equal)
MapAddDifferentSteadyState 0.00 0.00 ~ (all equal)
MapAddDifferentSteadyState-6 0.00 0.00 ~ (all equal)
MapAddDifferentSteadyState-48 0.00 0.00 ~ (all equal)
RealworldExpvarUsage 0.00 0.00 ~ (all equal)
RealworldExpvarUsage-6 0.00 0.00 ~ (all equal)
RealworldExpvarUsage-48 0.00 0.00 ~ (all equal)
https://perf.golang.org/search?q=upload:20170427.1
Change-Id: I388b2e8a3cadb84fc1418af8acfc27338f799273
Reviewed-on: https://go-review.googlesource.com/41930
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
Change-Id: I0fa68ca9812fe5e82ffb9d0b9598e95b47183eb8
Reviewed-on: https://go-review.googlesource.com/38011
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
|
Add a benchmark for setting a String value, which we may
want to treat differently from Int or Float due to the need to support
Add methods for the latter.
Update tests to use only the exported API instead of making (fragile)
assumptions about unexported fields.
The existing Map benchmarks construct a new Map for each iteration, which
focuses the benchmark results on the initial allocation costs for the
Map and its entries. This change adds variants of the benchmarks which
use a long-lived map in order to measure steady-state performance for
Map updates on existing keys.
Updates #18177
Change-Id: I62c920991d17d5898c592446af382cd5c04c528a
Reviewed-on: https://go-review.googlesource.com/36959
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
bradfitz noted in change 36717 that the new behavior was no longer
comparable with the old. This change restores comparable behavior
for -cpu=1.
BenchmarkMapAddSame 909 909 +0.00%
BenchmarkMapAddSame-6 1309 262 -79.98%
BenchmarkMapAddDifferent 2856 3030 +6.09%
BenchmarkMapAddDifferent-6 3803 581 -84.72%
updates #18177
Change-Id: Ifaff5a1f48be92002d86c296220313b7efdc81d6
Reviewed-on: https://go-review.googlesource.com/36723
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
|
The other expvar tests are already parallelized, and this will help to
measure the impact of potential implementations for #18177.
updates #18177
Change-Id: I0f4f1a16a0285556cbcc8339855b6459af412675
Reviewed-on: https://go-review.googlesource.com/36717
Reviewed-by: Russ Cox <rsc@golang.org>
|
|
Closes #15815
Change-Id: I08154dbff416198cf7787e446b1e00e62c03a972
Reviewed-on: https://go-review.googlesource.com/30917
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
|
Add a method to expose the handler to allow it to be installed at a
non-standard location or used with a different ServeMux.
fixes #15030
Change-Id: If778ad6fcc200f124a05c0a493511e364fca6078
Reviewed-on: https://go-review.googlesource.com/24722
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
|
Fixes #15088.
Change-Id: I7727829a4062e15c0e5e3beff4d0bfc1fa327b0f
Reviewed-on: https://go-review.googlesource.com/23232
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
|
|
Change-Id: I5147dbf4e85cf42cd1f32c57861e4c16d9dbd049
Reviewed-on: https://go-review.googlesource.com/21529
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
|
|
valid JSON value.
Change-Id: If4e740f3dbef4053355542eebdd899b3099d872c
Reviewed-on: https://go-review.googlesource.com/21525
Reviewed-by: Andrew Gerrand <adg@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>
|
|
Also added a test to ensure the behavior.
Fixes #14150
Change-Id: Ib3ee9fdae59826fa594ce1be3c49b51d740b56eb
Reviewed-on: https://go-review.googlesource.com/19915
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
|
Float type from a mutex to atomic bit array in a manner akin to
Google Guava's AtomicDouble[0], including adding a benchmark for the
type (benchcmp included below) along with some expvar_test.go cruft
being fixed.
benchmark old ns/op new ns/op delta
BenchmarkFloatSet 115 9.37 -91.85%
BenchmarkFloatAdd 114 17.1 -85.00%
benchmark old allocs new allocs delta
BenchmarkFloatSet 0 0 +0.00%
BenchmarkFloatAdd 0 0 +0.00%
benchmark old bytes new bytes delta
BenchmarkFloatSet 0 0 +0.00%
BenchmarkFloatAdd 0 0 +0.00%
[0] - http://goo.gl/m4dtlI
Change-Id: I4ce6a913734ec692e3ed243f6e6f7c11da4c6036
Reviewed-on: https://go-review.googlesource.com/3687
Reviewed-by: Rob Pike <r@golang.org>
|
|
Change-Id: I6ee7aa76673e51576b5a84c512b22a0f8af5b02f
Reviewed-on: https://go-review.googlesource.com/3966
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
|
|
These benchmarks are only for functions commonly used in loops. The
other functions are typically used for inspection or setup and thus are
not performance sensitive.
Change-Id: I8d0a0ba2d8234ecacb40fa3aa9077bf93c8fe89c
Reviewed-on: https://go-review.googlesource.com/3680
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
|
|
Using a mutex to protect a single int operation is quite heavyweight.
Using sync/atomic provides much better performance. This change was
benchmarked as such:
BenchmarkSync 10000000 139 ns/op
BenchmarkAtomic 200000000 9.90 ns/op
package blah
import (
"sync"
"sync/atomic"
"testing"
)
type Int struct {
mu sync.RWMutex
i int64
}
func (v *Int) Add(delta int64) {
v.mu.Lock()
defer v.mu.Unlock()
v.i += delta
}
type AtomicInt struct {
i int64
}
func (v *AtomicInt) Add(delta int64) {
atomic.AddInt64(&v.i, delta)
}
func BenchmarkSync(b *testing.B) {
s := new(Int)
for i := 0; i < b.N; i++ {
s.Add(1)
}
}
func BenchmarkAtomic(b *testing.B) {
s := new(AtomicInt)
for i := 0; i < b.N; i++ {
s.Add(1)
}
}
Change-Id: I6998239c785967647351bbfe8533c38e4894543b
Reviewed-on: https://go-review.googlesource.com/3430
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
|
|
Preparation was in CL 134570043.
This CL contains only the effect of 'hg mv src/pkg/* src'.
For more about the move, see golang.org/s/go14nopkg.
|