RFR: 8317980: Optimization for Integer.parseInt and Long.parseLong
Chen Liang
liach at openjdk.org
Thu Oct 12 02:20:50 UTC 2023
On Tue, 10 Oct 2023 02:54:05 GMT, Shaojin Wen <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 682:
> 680: */
> 681: public static int parseInt(String s) throws NumberFormatException {
> 682: if (s != null && s.coder() == String.LATIN1) {
Does this code block actually speed up `parseInt`? I recommend you remove this code block and test `parseInt` and `parseLong` again only with new NumberFormatException factories.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16112#discussion_r1351791166
More information about the core-libs-dev
mailing list