-
Type:
Enhancement
-
Resolution: Fixed
-
Priority:
P4
-
Affects Version/s: None
-
Component/s: core-libs
-
b06
During TemplatedStrings work Jim noticed that we could probably profit from reuse the same table lookup mechanism we're using for the rightmost bytes also for the 1 or 2 leftmeost bytes:
// We know there are at most two digits left at this point.
buf[--charPos] = DigitOnes[-i];
if (i < -9) {
buf[--charPos] = DigitTens[-i];
}
This avoids some arithmetic, and the tables are likely to be cached. A small improvements on microbenchmarks, including Integers.toString, can be observed.
// We know there are at most two digits left at this point.
buf[--charPos] = DigitOnes[-i];
if (i < -9) {
buf[--charPos] = DigitTens[-i];
}
This avoids some arithmetic, and the tables are likely to be cached. A small improvements on microbenchmarks, including Integers.toString, can be observed.