8245304: Re-examine ThreadLocal usage in java.math.BigDecimal

Alan Bateman Alan.Bateman at oracle.com
Wed Aug 12 06:34:20 UTC 2020


On 11/08/2020 18:32, Brian Burkhalter wrote:
> To fix [1], please consider [2] which replaces the ThreadLocal “threadLocalStringBuilderHelper” with straightforward use of a StringBuilderHelper instance. The initial capacity of the StringBuilder instance variable of StringBuilderHelper is also doubled from 16 to 32.
>
> Microbenchmarking was effected primarily using BigDecimal.toEngineeringString(). This method and toString() both invoke layoutChars() which used the ThreadLocal. The toString() method caches its return value but toEngineeringString() does not.
>
>
Looks good.

-Alan


More information about the core-libs-dev mailing list