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

Reply via email to