JDK 9 RFR of 6375303: Review use of caching in BigDecimal
Brian Burkhalter
brian.burkhalter at oracle.com
Fri Mar 14 00:29:42 UTC 2014
On Mar 12, 2014, at 2:08 AM, Peter Levart wrote:
> Huh! This is a ThreadLocalRandom anti-pattern. Thou should not use a ThreadLocalRandom instance in a thread that did not obtain it via a call to ThreadLocalRandom.current()…
Good point.
> You could create a new BigInteger(512, rnd) in the static initializer and use it to create new BigDecima(bigInteger) in testFirstToStrin.
I simply replaced ThreadLocalRandom with Random which probably creates a bottleneck but there is no significant difference in the results.
http://cr.openjdk.java.net/~bpb/6375303/Bench6375303.java
http://cr.openjdk.java.net/~bpb/6375303/6375303-bench.html
Thanks,
Brian
More information about the core-libs-dev
mailing list