aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Joiner <anacrolix@gmail.com>2020-10-01 13:27:01 +1000
committerMatt Joiner <anacrolix@gmail.com>2020-10-01 13:27:01 +1000
commit196642dc25c4c8ad68e24ee75905744522da83b4 (patch)
treed4eb1318d91080ccd00ecf0da815aff4be705142
parentNew Tx must have completed=false (diff)
downloadstm-196642dc25c4c8ad68e24ee75905744522da83b4.tar.gz
stm-196642dc25c4c8ad68e24ee75905744522da83b4.tar.xz
Add benchmark utils
-rwxr-xr-xbench8
-rw-r--r--benches/47e5cc618
-rw-r--r--benches/5df0d3b18
-rw-r--r--benches/6efb03218
-rw-r--r--benches/a3e788d18
-rw-r--r--benches/bf1dcaa18
-rw-r--r--benches/e0a706d18
-rwxr-xr-xdescribe1
8 files changed, 117 insertions, 0 deletions
diff --git a/bench b/bench
new file mode 100755
index 0000000..d3f2a1f
--- /dev/null
+++ b/bench
@@ -0,0 +1,8 @@
+benchout="benches/$(./describe)"
+echo
+echo writing "$benchout"
+echo
+go test -bench . -benchtime 3s -benchmem | tee "$benchout"
+echo
+echo wrote "$benchout"
+echo
diff --git a/benches/47e5cc6 b/benches/47e5cc6
new file mode 100644
index 0000000..fa2569d
--- /dev/null
+++ b/benches/47e5cc6
@@ -0,0 +1,18 @@
+goos: darwin
+goarch: amd64
+pkg: github.com/anacrolix/stm
+BenchmarkAtomicGet-12 222465180 15.2 ns/op 0 B/op 0 allocs/op
+BenchmarkAtomicSet-12 43109235 99.3 ns/op 32 B/op 1 allocs/op
+BenchmarkIncrementSTM-12 1354 2385370 ns/op 88224 B/op 5091 allocs/op
+BenchmarkIncrementMutex-12 14100 254194 ns/op 18 B/op 2 allocs/op
+BenchmarkIncrementChannel-12 6942 629400 ns/op 126 B/op 1 allocs/op
+BenchmarkReadVarSTM-12 12786 261026 ns/op 112 B/op 3 allocs/op
+BenchmarkReadVarMutex-12 13377 278505 ns/op 29 B/op 2 allocs/op
+BenchmarkReadVarChannel-12 13536 265976 ns/op 112 B/op 2 allocs/op
+BenchmarkPingPong4-12 504828 7014 ns/op 1009 B/op 43 allocs/op
+BenchmarkPingPong-12 722802 4928 ns/op 269 B/op 11 allocs/op
+BenchmarkThunderingHerdCondVar-12 3708 861135 ns/op 194 B/op 6 allocs/op
+BenchmarkThunderingHerd-12 8 429388582 ns/op 1807664 B/op 165867 allocs/op
+BenchmarkInvertedThunderingHerd-12 307 12490034 ns/op 3033682 B/op 46298 allocs/op
+PASS
+ok github.com/anacrolix/stm 64.909s
diff --git a/benches/5df0d3b b/benches/5df0d3b
new file mode 100644
index 0000000..ff73a58
--- /dev/null
+++ b/benches/5df0d3b
@@ -0,0 +1,18 @@
+goos: darwin
+goarch: amd64
+pkg: github.com/anacrolix/stm
+BenchmarkAtomicGet-12 239515498 15.1 ns/op 0 B/op 0 allocs/op
+BenchmarkAtomicSet-12 40938225 88.5 ns/op 32 B/op 1 allocs/op
+BenchmarkIncrementSTM-12 1842 2576851 ns/op 88610 B/op 5088 allocs/op
+BenchmarkIncrementMutex-12 14599 247228 ns/op 18 B/op 2 allocs/op
+BenchmarkIncrementChannel-12 5917 546238 ns/op 127 B/op 1 allocs/op
+BenchmarkReadVarSTM-12 14252 264976 ns/op 112 B/op 3 allocs/op
+BenchmarkReadVarMutex-12 13539 265940 ns/op 29 B/op 2 allocs/op
+BenchmarkReadVarChannel-12 14528 262082 ns/op 112 B/op 2 allocs/op
+BenchmarkPingPong4-12 524444 6889 ns/op 1015 B/op 43 allocs/op
+BenchmarkPingPong-12 757886 4619 ns/op 277 B/op 11 allocs/op
+BenchmarkThunderingHerdCondVar-12 4435 810640 ns/op 190 B/op 6 allocs/op
+BenchmarkThunderingHerd-12 7 455571474 ns/op 1992417 B/op 186304 allocs/op
+BenchmarkInvertedThunderingHerd-12 295 12936709 ns/op 3048421 B/op 46204 allocs/op
+PASS
+ok github.com/anacrolix/stm 65.306s
diff --git a/benches/6efb032 b/benches/6efb032
new file mode 100644
index 0000000..0fd6832
--- /dev/null
+++ b/benches/6efb032
@@ -0,0 +1,18 @@
+goos: darwin
+goarch: amd64
+pkg: github.com/anacrolix/stm
+BenchmarkAtomicGet-12 260272291 14.7 ns/op 0 B/op 0 allocs/op
+BenchmarkAtomicSet-12 9419424 386 ns/op 32 B/op 1 allocs/op
+BenchmarkIncrementSTM-12 1682 2711035 ns/op 782649 B/op 12175 allocs/op
+BenchmarkIncrementMutex-12 13474 257079 ns/op 18 B/op 2 allocs/op
+BenchmarkIncrementChannel-12 6813 580331 ns/op 125 B/op 1 allocs/op
+BenchmarkReadVarSTM-12 12924 268537 ns/op 112 B/op 3 allocs/op
+BenchmarkReadVarMutex-12 13797 265680 ns/op 27 B/op 2 allocs/op
+BenchmarkReadVarChannel-12 14151 257168 ns/op 112 B/op 2 allocs/op
+BenchmarkPingPong4-12 397308 9367 ns/op 5796 B/op 116 allocs/op
+BenchmarkPingPong-12 625650 6469 ns/op 1489 B/op 29 allocs/op
+BenchmarkThunderingHerdCondVar-12 3400 901840 ns/op 187 B/op 6 allocs/op
+BenchmarkThunderingHerd-12 274 12976135 ns/op 2783426 B/op 42759 allocs/op
+BenchmarkInvertedThunderingHerd-12 232 16377186 ns/op 6113834 B/op 83333 allocs/op
+PASS
+ok github.com/anacrolix/stm 64.875s
diff --git a/benches/a3e788d b/benches/a3e788d
new file mode 100644
index 0000000..c7068b4
--- /dev/null
+++ b/benches/a3e788d
@@ -0,0 +1,18 @@
+goos: darwin
+goarch: amd64
+pkg: github.com/anacrolix/stm
+BenchmarkAtomicGet-12 257472974 16.1 ns/op 0 B/op 0 allocs/op
+BenchmarkAtomicSet-12 9493024 403 ns/op 32 B/op 1 allocs/op
+BenchmarkIncrementSTM-12 1496 2429250 ns/op 86890 B/op 4981 allocs/op
+BenchmarkIncrementMutex-12 12849 277652 ns/op 18 B/op 2 allocs/op
+BenchmarkIncrementChannel-12 6734 549540 ns/op 125 B/op 1 allocs/op
+BenchmarkReadVarSTM-12 13473 269947 ns/op 112 B/op 3 allocs/op
+BenchmarkReadVarMutex-12 13050 274890 ns/op 27 B/op 2 allocs/op
+BenchmarkReadVarChannel-12 14524 259326 ns/op 112 B/op 2 allocs/op
+BenchmarkPingPong4-12 666799 6055 ns/op 982 B/op 43 allocs/op
+BenchmarkPingPong-12 807982 4246 ns/op 216 B/op 10 allocs/op
+BenchmarkThunderingHerdCondVar-12 3808 938140 ns/op 182 B/op 6 allocs/op
+BenchmarkThunderingHerd-12 282 13158514 ns/op 835252 B/op 21804 allocs/op
+BenchmarkInvertedThunderingHerd-12 289 12631693 ns/op 3056736 B/op 46881 allocs/op
+PASS
+ok github.com/anacrolix/stm 64.562s
diff --git a/benches/bf1dcaa b/benches/bf1dcaa
new file mode 100644
index 0000000..8b84869
--- /dev/null
+++ b/benches/bf1dcaa
@@ -0,0 +1,18 @@
+goos: darwin
+goarch: amd64
+pkg: github.com/anacrolix/stm
+BenchmarkAtomicGet-12 279588327 15.7 ns/op 0 B/op 0 allocs/op
+BenchmarkAtomicSet-12 9108991 389 ns/op 32 B/op 1 allocs/op
+BenchmarkIncrementSTM-12 1341 2766173 ns/op 87046 B/op 4981 allocs/op
+BenchmarkIncrementMutex-12 13270 286882 ns/op 20 B/op 2 allocs/op
+BenchmarkIncrementChannel-12 6426 591176 ns/op 127 B/op 1 allocs/op
+BenchmarkReadVarSTM-12 13999 259642 ns/op 112 B/op 3 allocs/op
+BenchmarkReadVarMutex-12 13486 277372 ns/op 27 B/op 2 allocs/op
+BenchmarkReadVarChannel-12 13808 258589 ns/op 112 B/op 2 allocs/op
+BenchmarkPingPong4-12 630103 6051 ns/op 950 B/op 43 allocs/op
+BenchmarkPingPong-12 890810 4993 ns/op 214 B/op 10 allocs/op
+BenchmarkThunderingHerdCondVar-12 3889 879404 ns/op 187 B/op 6 allocs/op
+BenchmarkThunderingHerd-12 294 13252970 ns/op 708701 B/op 21736 allocs/op
+BenchmarkInvertedThunderingHerd-12 238 13073573 ns/op 3090179 B/op 46844 allocs/op
+PASS
+ok github.com/anacrolix/stm 65.117s
diff --git a/benches/e0a706d b/benches/e0a706d
new file mode 100644
index 0000000..2c26910
--- /dev/null
+++ b/benches/e0a706d
@@ -0,0 +1,18 @@
+goos: darwin
+goarch: amd64
+pkg: github.com/anacrolix/stm
+BenchmarkAtomicGet-12 246978188 14.9 ns/op 0 B/op 0 allocs/op
+BenchmarkAtomicSet-12 36452851 99.9 ns/op 32 B/op 1 allocs/op
+BenchmarkIncrementSTM-12 1520 2231932 ns/op 90997 B/op 5081 allocs/op
+BenchmarkIncrementMutex-12 14769 249063 ns/op 16 B/op 2 allocs/op
+BenchmarkIncrementChannel-12 7608 525664 ns/op 126 B/op 1 allocs/op
+BenchmarkReadVarSTM-12 14209 268316 ns/op 112 B/op 3 allocs/op
+BenchmarkReadVarMutex-12 13527 269832 ns/op 28 B/op 2 allocs/op
+BenchmarkReadVarChannel-12 14137 251438 ns/op 112 B/op 2 allocs/op
+BenchmarkPingPong4-12 267039 12062 ns/op 1254 B/op 60 allocs/op
+BenchmarkPingPong-12 538322 5983 ns/op 264 B/op 12 allocs/op
+BenchmarkThunderingHerdCondVar-12 3691 849242 ns/op 191 B/op 6 allocs/op
+BenchmarkThunderingHerd-12 1 62422007724 ns/op 1626920 B/op 54434 allocs/op
+BenchmarkInvertedThunderingHerd-12 211 16067788 ns/op 3205018 B/op 56345 allocs/op
+PASS
+ok github.com/anacrolix/stm 119.563s
diff --git a/describe b/describe
new file mode 100755
index 0000000..77a418b
--- /dev/null
+++ b/describe
@@ -0,0 +1 @@
+echo $(git rev-parse --short HEAD)$(git diff --quiet || echo -dirty)