On Fri, 22 Sep 2023 13:50:37 GMT, Shaojin Wen <d...@openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/util/DecimalDigits.java line 115: >> >>> 113: } >>> 114: return 10 + d; >>> 115: } >> >> @wenshao How about of using >> [this](https://github.com/plokhotnyuk/jsoniter-scala/blob/6b72cf75ad7f53e8a285d512009d164c3eabbb3a/jsoniter-scala-core/jvm/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/core/JsonWriter.scala#L2367-L2369) >> trick to avoid multiplications in a loop? > > This implementation is copied from Integer.stringSize. In 2015, @Shipilev > modified the table lookup to the current implementation. In actual testing, > this algorithm is faster. No doubt, but that algorithm could have been easily integrated into the Digits implementation without disruption. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1334490412