RFR (S) 8136500: Integer/Long getChars and stringSize should be more idiomatic
Vitaly Davidovich
vitalyd at gmail.com
Tue Nov 24 00:44:57 UTC 2015
Ah, the good 'ole switch statement earning more optimization jiras :).
sent from my phone
On Nov 23, 2015 7:36 PM, "John Rose" <john.r.rose at oracle.com> wrote:
> On Nov 23, 2015, at 1:42 PM, Aleksey Shipilev <aleksey.shipilev at oracle.com>
> wrote:
> >
> > Okay, here it is (only tests changed):
> > http://cr.openjdk.java.net/~shade/8136500/webrev.06/ <
> http://cr.openjdk.java.net/~shade/8136500/webrev.06/>
>
> Thanks; that's a solid test.
>
> Cleanups are good too.
>
> You can count me as a reviewer.
>
> — John
>
> P.S. I think a promising stringSize for *random* inputs would
> switch on numberOfLeadingZeros and then perform at most
> one comparison per case. We'd have to improve our game
> optimizing switches, though, not to hurt performance on
> the naturally occurring distributions.
>
> Again, Integer.toString for *random* inputs is an interesting
> problem that is probably amenable to divide-and-conquer,
> or at least to encoding more than one digit at a time.
>
> P.P.S. I filed https://bugs.openjdk.java.net/browse/JDK-8143859 <
> https://bugs.openjdk.java.net/browse/JDK-8143859>
> to track an underlying problem with the JIT, which is that
> it should be balancing those test trees for you.
More information about the core-libs-dev
mailing list