JDK 9 RFR of 6375303: Review use of caching in BigDecimal (original) (raw)
Brian Burkhalter brian.burkhalter at oracle.com
Fri Mar 14 00:29:42 UTC 2014
- Previous message: JDK 9 RFR of 6375303: Review use of caching in BigDecimal
- Next message: JDK 9 RFR of 6375303: Review use of caching in BigDecimal
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: JDK 9 RFR of 6375303: Review use of caching in BigDecimal
- Next message: JDK 9 RFR of 6375303: Review use of caching in BigDecimal
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]