RFR: 8316150: Refactor get chars and string size

Andriy Plokhotnyuk duke at openjdk.org
Mon Oct 16 16:18:20 UTC 2023


On Wed, 13 Sep 2023 01:24:05 GMT, Shaojin Wen <duke at openjdk.org> wrote:

> 1. Reduce duplicate stringSize code
> 2. Move java.lang.StringLatin1.getChars to jdk.internal.util.DecimalDigits::getCharLatin1,not only java.lang, other packages also need to use this method

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?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1334280362


More information about the core-libs-dev mailing list