RFR: 8317980: Optimization for Integer.parseInt and Long.parseLong

Shaojin Wen duke at openjdk.org
Thu Oct 12 02:20:49 UTC 2023


On Wed, 11 Oct 2023 10:30:26 GMT, David Schlosnagle <duke at openjdk.org> wrote:

>> By extracting the code that creates the exception, the CodeSize of these methods is less than the default FreqInlineSize 325.  and for the scenario where the most commonly used radix is not specified and the String coder is LATIN1, fast-path can improves the performance 10% of parseInt(String)/parseLong(String).
>
> src/java.base/share/classes/java/lang/Integer.java line 560:
> 
>> 558:         if (radix > Character.MAX_RADIX) {
>> 559:             throw NumberFormatException.forMaxRadix(radix);
>> 560:         }
> 
> It sounds like these methods are now already under the default common inline threshold, but wondering if it would be worthwhile to pull out the radix validation to a separate method.

Code style should be consistent

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16112#discussion_r1355901164


More information about the core-libs-dev mailing list