Hi Claes!
Looks good to me!
The comment
630 // Reset the shared buffer
should probably be moved down to
645 out.setLength(0);
With kind regards,
Ivan
On 5/23/19 5:57 AM, Claes Redestad wrote:
Hi Ivan!
On 2019-05-23 02:11, Ivan Gerasimov wrote:
Hi Claes!
A few comments:
1)
571 if (len == lineBuf.length) {
572 int newLength =
ArraysSupport.newLength(lineBuf.length, 1, lineBuf.length);
could be written slightly shorter as
571 if (len == lineBuf.length) {
572 int newLength =
ArraysSupport.newLength(len, 1, len);
2)
585 if (len == 0) {
586 skipWhiteSpace = true;
587 len = 0;
no need to update len here
nice catches, fixed.
3)
In loadConvert(char[] in, int off, int len, StringBuilder out):
It may make sense to first scan the input buffer for backslash, and
if not found (should be a common case), return new String(in, off,
len), so a copying to the StringBuilder will be avoided.
Otherwise:
out.append(in, off, posOfSlash - off);
off = posOfSlash;
and continue as before...
Right, this got a bit murky since String(char[], int, int) runs through
a noisy compress method and execute more bytecode in profiles. Still it
comes out a bit faster in a few real measurements, probably due to doing
fewer calls from interpreter to compiled code in the end:
http://cr.openjdk.java.net/~redestad/8224202/open.03/
Thanks!
/Claes
--
With kind regards,
Ivan Gerasimov