true. not roust that way. also, it uses "Go array bounds checking" as the implicit test for crazy out of range values. just a 5 min stream of consciousness hack to defend the honor of the Go atomic primitives. ;-) It was typed one handed while the the other propped up my macbook here in bed. easily improved.
in fact, i did improve it after sending that original email. i added outer loops to time repeatedly, and above that, to iterate across numbers of workers. also added an option to have the workers do a little work between atomic operations just to see the expected "atomic cost in the noise" by direct experience...
...works great, scales well.
4cpu+4smt cpus
celeste:atom mtj$ time atom
1 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 18.21601 sec
2 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 9.44632 sec
3 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 6.77645 sec
4 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 5.07302 sec
5 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 4.54578 sec
6 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 3.59711 sec
7 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 3.21376 sec
8 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 2.98081 sec
18+18
xplum:atom mtj$ time atom
1 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 15.36729 sec
2 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 8.05586 sec
3 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 5.71047 sec
4 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 4.25619 sec
5 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 3.50413 sec
6 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 2.95954 sec
7 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 2.57278 sec
8 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 2.29949 sec
9 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 2.14102 sec
10 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.96580 sec
11 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.86208 sec
12 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.75674 sec
13 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.67355 sec
14 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.60104 sec
15 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.55347 sec
16 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.46876 sec
17 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.47974 sec
18 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.46271 sec
19 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.42377 sec
20 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.37417 sec
21 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.38023 sec
22 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.32782 sec
23 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.33747 sec
24 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.27842 sec
25 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.27863 sec
26 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.22864 sec
27 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.21858 sec
28 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.21807 sec
29 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.16772 sec
30 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.15762 sec
31 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.15192 sec
32 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.10269 sec
33 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.09875 sec
34 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.09120 sec
35 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.08135 sec
36 workers, 256 batches of 131072 atomic increments, 33554432 total increments: 1.09140 sec