RFR: 8273329: Remove redundant null check from String.getBytes(String charsetName)
Сергей Цыпанов
github.com+10835776+stsypanov at openjdk.java.net
Fri Sep 3 19:34:06 UTC 2021
On Fri, 3 Sep 2021 14:04:27 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
> Redundant null checks get collapsed by HotSpot, so not a performance improvement.
Hi Roger, indeed, no improvement observed. How did you know it beforehand? I was pretty sure we are going to win a couple of ns on this wide-used method.
P.S. This double-check of null seems to be a left-over from https://github.com/openjdk/jdk/pull/2102. Previously there was only one NPE-throwing check there, but after `String.encode(Charset, byte, byte[])` was introduced we have two of them.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5361
More information about the core-libs-dev
mailing list