Skip to content

Instantly share code, notes, and snippets.

Code:
[Entry Point]
[Constants]
# {method} {0x0000000125c23120} 'inc' '()V' in 'org/jctools/counters/FixedSizeStripedLongCounterV8'
# [sp+0x30] (sp of caller)
0x000000010c7de2a0: mov 0x8(%rsi),%r10d
0x000000010c7de2a4: shl $0x3,%r10
0x000000010c7de2a8: cmp %r10,%rax
0x000000010c7de2ab: jne 0x000000010c6e6e20 ; {runtime_call}
0x000000010c7de2b1: data32 xchg %ax,%ax
32 stripes, 8u72, 32-cores Xeon with disabled hyper-threading
taskset -c 0-3 java -jar microbenchmarks.jar CountersBenchmark -bm avgt -tg 1,3
Benchmark (counterType) Mode Cnt Score Error Units
CountersBenchmark.rw AtomicLong avgt 20 108.288 ± 9.195 ns/op
CountersBenchmark.rw:get AtomicLong avgt 20 27.755 ± 4.454 ns/op
CountersBenchmark.rw:inc AtomicLong avgt 20 135.132 ± 10.859 ns/op
CountersBenchmark.rw LongAdder avgt 20 48.061 ± 1.584 ns/op
CountersBenchmark.rw:get LongAdder avgt 20 75.350 ± 3.876 ns/op
package org.qwwdfsad.benchmarks;
import com.google.gson.Gson;
import org.openjdk.jmh.annotations.*;
import java.util.concurrent.TimeUnit;
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Threads(8)