RFR: 8316150: Refactor get chars and string size [v7]
温绍锦
duke at openjdk.org
Fri Sep 22 13:53:13 UTC 2023
On Fri, 22 Sep 2023 11:53:18 GMT, Andriy Plokhotnyuk <duke at openjdk.org> wrote:
>> 温绍锦 has updated the pull request incrementally with one additional commit since the last revision:
>>
>> restore HexDigits & OctalDigits
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1334411468
More information about the core-libs-dev
mailing list