Where possible, switch to the Long.parseLong variant that accepts a start and end index for the supplied CharSequence, thus avoiding making an unnecessary copy of the input.

Comment From: sbrannen

@kilink, thanks for the PR.

Have you experienced any performance issues which inspired you to make the proposed changes?

Comment From: kilink

@kilink, thanks for the PR.

Have you experienced any performance issues which inspired you to make the proposed changes?

I did not observe any issue in particular, but I had noticed that the Integer.parseInteger variant that takes start / end indices is being used throughout the codebase, and it seemed like the same optimization hadn't been applied for instances of Long.parseLong where it is possible to avoid creating a substring.

Comment From: sbrannen

I did not observe any issue in particular, but I had noticed that the Integer.parseInteger variant that takes start / end indices is being used throughout the codebase, and it seemed like the same optimization hadn't been applied for instances of Long.parseLong where it is possible to avoid creating a substring.

Thanks for the feedback.

Indeed, we made that change for Integer.parseInt in conjunction with #27680.

In light of that, I'll schedule this improvement for 6.1 M4.

Comment From: sbrannen

This has been merged into main.

Thanks