Commit graph

22 commits

Author SHA1 Message Date
Austin Clements 6a44a3aa9f test/bench/go1: eliminate start-up time
The go1 benchmark suite does a lot of work at package init time, which
makes it take quite a while to run even if you're not running any of
the benchmarks, or if you're only running a subset of them. This leads
to an awkward workaround in dist test to compile but not run the
package, unlike roughly all other packages. It also reduces isolation
between benchmarks by affecting the starting heap size of all
benchmarks.

Fix this by initializing all data required by a benchmark when that
benchmark runs, and keeping it local so it gets freed by the GC and
doesn't leak between benchmarks. Now, none of the benchmarks depend on
global state.

Re-initializing the data on each benchmark run does add overhead to an
actual benchmark run, as each benchmark function is called several
times with different values of b.N. A full run of all benchmarks at
the default -benchtime=1s now takes ~10% longer; higher -benchtimes
would be less. It would be quite difficult to cache this data between
invocations of the same benchmark function without leaking between
different benchmarks and affecting GC overheads, as the testing
package doesn't provide any mechanism for this.

This reduces the time to run the binary with no benchmarks from 1.5
seconds to 10 ms, and also reduces the memory required to do this from
342 MiB to 17 MiB.

To make sure data was not leaking between different benchmarks, I ran
the benchmarks with -shuffle=on. The variance remained low: mostly
under 3%. A few benchmarks had higher variance, but in all cases it
was similar to the variance between this change.

This CL naturally changes the measured performance of several of the
benchmarks because it dramatically changes the heap size and hence GC
overheads. However, going forward the benchmarks should be much better
isolated.

For #37486.

Change-Id: I252ebea703a9560706cc1990dc5ad22d1927c7a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/443336
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Austin Clements <austin@google.com>
2022-11-01 17:07:14 +00:00
nimelehin a66190ecee test/bench/go1: fix size for RegexpMatchMedium_32
Change-Id: Idc67abb95248bc010820a89dd6096a2da334e723
GitHub-Last-Rev: ae9014b011
GitHub-Pull-Request: golang/go#47254
Reviewed-on: https://go-review.googlesource.com/c/go/+/335189
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
2021-07-18 21:03:43 +00:00
KimMachineGun a040ebeb98 all: update references to symbols moved from io/ioutil to io
Update references missed in CL 263142.

For #41190

Change-Id: I778760a6a69bd0440fec0848bdef539c9ccb4ee1
GitHub-Last-Rev: dda42b09ff
GitHub-Pull-Request: golang/go#42874
Reviewed-on: https://go-review.googlesource.com/c/go/+/273946
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Zhang <cherryyz@google.com>
2021-04-05 17:51:15 +00:00
Bryan C. Mills b1a783df87 test/bench/go1: add go.mod file
cmd/dist executes 'go test' within this directory, so it needs a
go.mod file to tell the compiler what package path to use in
diagnostic and debug information.

Updates #30228

Change-Id: Ia313ac06bc0ec4631d415faa20c56cce2ac8dbc5
Reviewed-on: https://go-review.googlesource.com/c/go/+/165498
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-06 18:53:12 +00:00
Jason Travis 19040ac871 test/bench/go1: fix typo in parserdata_test.go comment
Change-Id: Iaca02660bdc8262db2b003a94aca661b5cec5576
Reviewed-on: https://go-review.googlesource.com/38437
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-22 03:23:16 +00:00
Vladimir Stefanovic 48b42d29dc test/bench/go1: reduce fasta data size for mips{,64}
Change-Id: I15887ee454acfdb36334dd9f0b59cc520b2b0286
Reviewed-on: https://go-review.googlesource.com/34311
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-13 22:04:23 +00:00
Emmanuel Odeke 53fd522c0d all: make copyright headers consistent with one space after period
Follows suit with https://go-review.googlesource.com/#/c/20111.

Generated by running
$ grep -R 'Go Authors.  All' * | cut -d":" -f1 | while read F;do perl -pi -e 's/Go
Authors.  All/Go Authors. All/g' $F;done

The code in cmd/internal/unvendor wasn't changed.

Fixes #15213

Change-Id: I4f235cee0a62ec435f9e8540a1ec08ae03b1a75f
Reviewed-on: https://go-review.googlesource.com/21819
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-02 13:43:18 +00:00
David Chase d8d33514f9 cmd/compile: Move divconst_test out of test/bench/go1
This is necessary to avoid disrupting the go1 suite and gives
us a place to put other tests of basic compiler function and
correctness.

Change-Id: I36933819ff2bfe6a2121fff2be9a98efd2123d9a
Reviewed-on: https://go-review.googlesource.com/22597
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-04-29 16:20:18 +00:00
Zhongwei Yao 74a9bad638 cmd/compile: enable const division for arm64
performance:
benchmark                   old ns/op     new ns/op     delta
BenchmarkDivconstI64-8      8.28          2.70          -67.39%
BenchmarkDivconstU64-8      8.28          4.69          -43.36%
BenchmarkDivconstI32-8      8.28          6.39          -22.83%
BenchmarkDivconstU32-8      8.28          4.43          -46.50%
BenchmarkDivconstI16-8      5.17          5.17          +0.00%
BenchmarkDivconstU16-8      5.33          5.34          +0.19%
BenchmarkDivconstI8-8       3.50          3.50          +0.00%
BenchmarkDivconstU8-8       3.51          3.50          -0.28%

Fixes #15382

Change-Id: Ibce7b28f0586d593b33c4d4ecc5d5e7e7c905d13
Reviewed-on: https://go-review.googlesource.com/22292
Reviewed-by: Michael Munday <munday@ca.ibm.com>
Reviewed-by: David Chase <drchase@google.com>
2016-04-27 17:47:49 +00:00
Russ Cox 20d745c57c encoding/base64: fix streaming decode of padding-free base64
Fixes #13384.

Change-Id: Id9e827acddc8de139f93c5de0c6486bc4334c7d4
Reviewed-on: https://go-review.googlesource.com/18330
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-08 15:07:45 +00:00
Rob Pike d526e5e79c go/test/bench/go1: add regexp test
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7480047
2013-03-12 16:50:10 -07:00
Brad Fitzpatrick ba6ea4a95c test/bench/go1: add http test
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7529048
2013-03-12 16:46:38 -07:00
Rob Pike 05403fa8fb go/test/bench/go1: add printf and time format tests
Also rename the go parser test to GoParse so it doesn't grab the globally useful Parse name.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7732044
2013-03-11 17:17:25 -07:00
Shenghou Ma 13075ed416 test/bench/go1: use raw string instead of string addition
to reduce compile time memory/stack usage.
Update #4970
$ go test -c ../test/bench/go1
before:
0.36user 0.07system 0:00.44elapsed 100%CPU
(0avgtext+0avgdata 540720maxresident)k
0inputs+19840outputs (0major+56451minor)pagefaults 0swaps
after:
0.33user 0.05system 0:00.39elapsed 100%CPU
(0avgtext+0avgdata 289936maxresident)k
0inputs+19864outputs (0major+29615minor)pagefaults 0swaps

And stack usage is reduced to below 1MiB.

R=golang-dev, r, dave
CC=golang-dev
https://golang.org/cl/7436050
2013-03-05 04:23:37 +08:00
Dave Cheney 6423682019 test/bench/go1: add go/parser benchmark
As discussed in

https://groups.google.com/d/msg/golang-dev/Na9XE6mcQyY/zbeBI7R-vnoJ

Here is a static copy of the go/parser benchmark. I ended up using
fancy encodings because the original parser.go had a number of `s
scattered throughout which made it hard to embed the source directly.

Curiously on my laptop this benchmark always scores roughly 10% higher
than the standalone benchmark. This may be down to the generation of
the fasta data set triggering the cpu governor to raise the cpu speed.
However the benchmark is consistent with itself across multiple runs.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6305055
2012-06-07 10:23:45 +10:00
Dave Cheney 166dab6993 test/bench/go1: reduce fasta data size for linux/arm
As discussed on golang-dev, reduce the size of the fasta
dataset to make it possible to run the go1 benchmarks on
small ARM systems.

Also, remove the 25m suffix from fasta data and Revcomp.

linux/arm: pandaboard OMAP4

BenchmarkBinaryTree17          1        70892426000 ns/op
BenchmarkFannkuch11            1        35712066000 ns/op
BenchmarkGobDecode            10         137146000 ns/op           5.60 MB/s
BenchmarkGobEncode            50          64953000 ns/op          11.82 MB/s
BenchmarkGzip          1        5675690000 ns/op           3.42 MB/s
BenchmarkGunzip        1        1207001000 ns/op          16.08 MB/s
BenchmarkJSONEncode            5         860424800 ns/op           2.26 MB/s
BenchmarkJSONDecode            1        3321839000 ns/op           0.58 MB/s
BenchmarkMandelbrot200        50          45893560 ns/op
BenchmarkRevcomp              10         135220300 ns/op          18.80 MB/s
BenchmarkTemplate              1        6385681000 ns/op           0.30 MB/s

R=rsc, minux.ma, dsymonds
CC=golang-dev
https://golang.org/cl/6278048
2012-06-06 07:49:58 +10:00
Shenghou Ma 6b4ae1d28e test/bench/go1: fix gzip test
We can't depend on init() order, and certainly we don't want to
register all future benchmarks that use jsonbytes or jsondata to init()
in json_test.go, so we use a more general solution: make generation of
jsonbytes and jsondata their own function so that the compiler will take
care of the order.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6282046
2012-06-05 00:14:39 +08:00
Russ Cox cb9759d067 test/bench/go1: add mandelbrot for floating point
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6244063
2012-05-30 10:26:59 -04:00
Shenghou Ma 90010f8f63 build: re-enable some broken tests in run.bash
Updates #2982.

R=rsc, rsc
CC=golang-dev
https://golang.org/cl/5759064
2012-03-08 06:23:56 +08:00
Rob Pike 905cb4881b all: remove some references to Make.inc etc.
There are a few more but these are the easiest ones.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5756067
2012-03-07 13:51:49 +11:00
Rob Pike 91cb3489ab go: move compilers into the go-tool directory
Also delete gotest, since it's messy to fix and slated for deletion anyway.
A couple of things outside src can't be tested any more. "go test" will be
fixed and these tests will be re-enabled. They're noisy for now.

Fixes #284.

R=rsc
CC=golang-dev
https://golang.org/cl/5598049
2012-01-30 14:46:31 -08:00
Russ Cox 6e8875551a test/bench/go1: first draft of Go 1 benchmark suite
I have included a few important microbenchmarks,
but the overall intent is to have mostly end-to-end
benchmarks timing real world operations.

The jsondata.go file is a summary of agl's
activity in various open source repositories.
It gets used as test data for many of the benchmarks.

Everything links into one binary (even the test data)
so that it is easy to run the benchmarks on many
computers: there is just one file to copy around.

R=golang-dev, r, bradfitz, adg, r
CC=golang-dev
https://golang.org/cl/5484071
2011-12-15 12:32:59 -05:00