locks: synchronized vs ReentrantLock vs StampedLock companion code
JMH throughput sweep (1-64 threads), 9:1 read-heavy @Group benchmark, tryLock(timeout) deadlock-avoidance demo, and a JDK21-vs-JDK25 JEP 491 virtual-thread-pinning comparison. Also promotes LICENSE to repo root now that a second module exists.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
$ java -jar target/benchmarks.jar ReadHeavyBenchmark -rf text
|
||||
(9 reader threads : 1 writer thread per lock type, via JMH @Group/@GroupThreads)
|
||||
|
||||
Benchmark Mode Cnt Score Error Units
|
||||
ReadHeavyBenchmark.reentrantLock thrpt 5 45225.344 ± 3890.955 ops/ms
|
||||
ReadHeavyBenchmark.reentrantLock:reentrantLockRead thrpt 5 39936.906 ± 3728.160 ops/ms
|
||||
ReadHeavyBenchmark.reentrantLock:reentrantLockWrite thrpt 5 5288.438 ± 1952.067 ops/ms
|
||||
ReadHeavyBenchmark.stampedLock thrpt 5 915584.241 ± 68486.471 ops/ms
|
||||
ReadHeavyBenchmark.stampedLock:stampedLockRead thrpt 5 914889.465 ± 69210.992 ops/ms
|
||||
ReadHeavyBenchmark.stampedLock:stampedLockWrite thrpt 5 694.777 ± 1802.294 ops/ms
|
||||
ReadHeavyBenchmark.synchronizedCounter thrpt 5 16320.540 ± 4834.389 ops/ms
|
||||
ReadHeavyBenchmark.synchronizedCounter:synchronizedRead thrpt 5 15319.823 ± 5526.566 ops/ms
|
||||
ReadHeavyBenchmark.synchronizedCounter:synchronizedWrite thrpt 5 1000.717 ± 860.855 ops/ms
|
||||
Reference in New Issue
Block a user