The repeat method in LZDecoder[1] currently copies individual bytes in
a loop. This could be changed to do batch copies:

        do {
          //it is possible for the "repeat" to include content which
is going to be generated here
          //so we have to limit ourselves to how much data is already
in the buffer (i.e. pos - back).
          final int toCopy = Math.min(left, Math.min(bufSize - back,
pos - back));
          System.arraycopy(buf, back, buf, pos, toCopy);
          pos += toCopy;
          back += toCopy;
          left -= toCopy;
          if (back == bufSize) {
              back = 0;
        } while (left > 0);

[1] -;a=blob;f=src/org/tukaani/xz/lz/;h=85b2ca1117461c9f3143e3baf592ab261e2ad1ca;hb=refs/heads/master#l79

Reply via email to