RFR: 8196331: Optimize Character.digit for latin1 input (original) (raw)
Paul Sandoz paul.sandoz at oracle.com
Mon Jan 29 19:38:41 UTC 2018
- Previous message: RFR: 8196331: Optimize Character.digit for latin1 input
- Next message: RFR: 8196331: Optimize Character.digit for latin1 input
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Smaller in only the upper bound? I would an explicit upper bounds check would dominate that of the bounds check for the array itself.
Paul.
On Jan 29, 2018, at 11:37 AM, Claes Redestad <claes.redestad at oracle.com> wrote:
I ran with a smaller byte[] initially and saw about a 10% improvement from removing the branch, which is why I felt the superfluous bytes were motivated. /Claes Paul Sandoz <paul.sandoz at oracle.com> skrev: (29 januari 2018 19:14:44 CET)
On Jan 29, 2018, at 9:44 AM, Martin Buchholz <martinrb at google.com> wrote: Thanks. I might try to shrink the size of the static array, by only storing values between '0' and 'z', at the cost of slightly greater lookup costs for each char. I was wondering the same, or just clip the end of the array to’z' if (ch <= ‘z’ && radix …) { // Might even fold the upper bounds check for DIGITS_ _value = DIGITS[ch];_ _..._ _}_ _Paul._ _On Mon, Jan 29, 2018 at 3:15 AM, Claes Redestad <claes.redestad at oracle.com> wrote: Hi, for the latin1 block of CharacterData we can improve the digit(int, int) implementation by providing an optimized lookup table. This improves microbenchmarks exercising Integer.parseInt, Long.parseLong and UUID.fromString etc by around 50%for typical inputs. Webrev: http://cr.openjdk.java.net/~redestad/8196331/open.00/ <http://cr.openjdk.java.net/~redestad/8196331/open.00/> Bug: https://bugs.openjdk.java.net/browse/JDK-8196331 <https://bugs.openjdk.java.net/browse/JDK-8196331> The lookup array is pre-calculated to minimize startup impact (adds 1,027 bytecodes executed during initialization) /Claes
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.
- Previous message: RFR: 8196331: Optimize Character.digit for latin1 input
- Next message: RFR: 8196331: Optimize Character.digit for latin1 input
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]