RFR 4641897: Faster string conversion of large integers
Victor Polischuk
victor2 at ukr.net
Thu Jun 20 07:46:04 UTC 2013
Hi Brain,
I believe that you can reuse "zeros" array which is declared in the class to improve:
// Pad with internal zeros if necessary.
// Don't pad if we're at the beginning of the string.
if ((s.length() < digits) && (sb.length() > 0))
for (int i=s.length(); i<digits; i++) // May be a faster way to
sb.append('0'); // do this?
Something like:
// Pad with internal zeros if necessary.
// Don't pad if we're at the beginning of the string.
if (sb.length() > 0)
for (int i = digits - s.length(); i > 0; i -= 63)
sb.append(i > 63 ? zeros[63] : zeros[i]);
Regards,
Victor Polischuk
--- Original message ---
From: "Brian Burkhalter" <brian.burkhalter at oracle.com>
Date: 19 June 2013, 22:59:03
> Continuing on from this thread
>
> http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-June/018181.html
>
> here is a new Request for Review, this time for
>
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4641897
>
> The webrev is here
>
> http://cr.openjdk.java.net/~bpb/4641897/
>
> The code changes have been reviewed by me and regression tests have been run on my development machine including the updated test which is in the webrev. Performance testing has been performed only insofar as to verify improvement at bit lengths much larger than the algorithm crossover threshold with the understanding that, as for 4837946 and 4646474, the threshold is subject to adjustment pending performance evaluation on a mix of platforms.
>
> Thanks,
>
> Brian
More information about the core-libs-dev
mailing list