<i18n dev> RFR: 8304245: Speed up CharacterData.of by avoiding bit shifting in the latin1 fast-path test [v2]

jmehrens duke at openjdk.org
Sat Mar 18 17:09:23 UTC 2023


On Wed, 15 Mar 2023 15:10:49 GMT, Eirik Bjorsnos <duke at openjdk.org> wrote:

>> We can do `Integer.compareUnsigned(ch, 0xFF) <= 0`
>
> We could, but benchmarks show no performance improvements over the current PR. I think the current code is perhaps slightly more readable.

Does non-short-circuit logical AND operator perform similar to baseline?  In this very specific case there is no risk of side effects due to method calls, no risk of null pointer exception because of primitives, and there is not an excessive amount of conditions.  Therefore, I would think either `&` or `&&` are viable options.

`if (ch >= 0 & ch <= 0xFF) {`

I ask just for the sake of my own learning on this topic as it relates to performance as opposed to code readability preferences.

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

PR: https://git.openjdk.org/jdk/pull/13040


More information about the i18n-dev mailing list