RFR 8017540: Improve multi-threaded contention behavior of BigInteger.toString() radix conversion cache

Steven Schlansker stevenschlansker at gmail.com
Tue Jun 25 21:12:02 UTC 2013

On Jun 25, 2013, at 1:56 PM, Peter Levart <peter.levart at gmail.com> wrote:
> Sorry, you are storing back when resizing. And you are resizing for every exponent that is bigger that previous requested (cached). This can lead to many resizings.

Hi everyone,

Apologies to butt in, and maybe this is a very stupid suggestion, but is the added complexity and potential for data race-introduced bugs worth the added efficiency over (for example) a ConcurrentMap<Long, BigInteger> with a key of "radix << 32 | exponent" ?

It is clearly not as efficient, but it does have the virtue that even mere mortals like myself can understand that it is safe code, and maybe it is "good enough"  :-)


More information about the core-libs-dev mailing list