java-tutorials/core-java-modules/core-java-concurrency-advan.../src
karl82 0b73db930f Update ThreadLocalRandom benchmark to show issues with contention (#8292)
Previous benchmark was measuring initialization of thread pools and
their shutdown, not really measuring performance of Random.nextInt()
shared Random instance vs ThreadLocalRandom.current()

Example when run with 8 threads

Benchmark                                                         Mode  Cnt     Score     Error   Units
ThreadLocalRandomBenchMarker.randomValuesUsingRandom             thrpt   20     9.597 ±   0.475  ops/us
ThreadLocalRandomBenchMarker.randomValuesUsingThreadLocalRandom  thrpt   20  2195.178 ± 109.579  ops/us
2020-01-30 11:10:20 -08:00
..
main/java/com/baeldung Update ThreadLocalRandom benchmark to show issues with contention (#8292) 2020-01-30 11:10:20 -08:00
test/java/com/baeldung