1
0
mirror of https://github.com/golang/go synced 2024-11-16 23:54:44 -07:00
The Go programming language
Go to file
Bryan C. Mills e9702c0c85 expvar: reduce sync.Map overhead for (*Map).Set
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>
2017-05-02 17:13:40 +00:00
.github doc: improve issue template and contribution guidelines 2017-02-11 20:42:06 +00:00
api math/big: define Word as uint instead of uintptr 2017-02-21 19:31:40 +00:00
doc spec: clarify admissible argument types for print, println 2017-04-28 16:37:31 +00:00
lib/time *.bash: always use the same string equality operator 2017-03-14 21:46:31 +00:00
misc misc/android: don't let the Android exec wrapper hang indefinitely 2017-05-01 22:31:15 +00:00
src expvar: reduce sync.Map overhead for (*Map).Set 2017-05-02 17:13:40 +00:00
test cmd/compile: fix error when typeswitching on untyped 2017-04-30 17:25:47 +00:00
.gitattributes .gitattributes: prevent all magic line ending changes 2014-12-12 23:14:54 +00:00
.gitignore .gitignore: change path to zbootstrap.go 2017-04-19 02:13:58 +00:00
AUTHORS A+C: automated update 2016-12-21 03:22:22 +00:00
CONTRIBUTING.md doc: improve issue template and contribution guidelines 2017-02-11 20:42:06 +00:00
CONTRIBUTORS A+C: automated update 2016-12-21 03:22:22 +00:00
favicon.ico website: recreate 16px and 32px favicon 2016-08-25 15:43:32 +00:00
LICENSE doc: revert copyright date to 2009 2016-06-01 22:40:04 +00:00
PATENTS LICENSE: separate, change PATENTS text 2010-12-06 16:31:59 -05:00
README.md readme: add attribution for the Gopher image 2017-02-03 19:39:41 +00:00
robots.txt godoc: serve robots.txt raw 2011-02-19 05:46:20 +11:00

The Go Programming Language

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Gopher image Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.

Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.

Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.

Download and Install

Binary Distributions

Official binary distributions are available at https://golang.org/dl/.

After downloading a binary release, visit https://golang.org/doc/install or load doc/install.html in your web browser for installation instructions.

Install From Source

If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source or load doc/install-source.html in your web browser for source installation instructions.

Contributing

Go is the work of hundreds of contributors. We appreciate your help!

To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html

Note that the Go project does not use GitHub pull requests, and that we use the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.