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