mirror of
https://github.com/google/brotli.git
synced 2024-11-25 13:00:06 +00:00
Speedup Java decoder. (#547)
* geo corpus decodes ~5% faster * fetchlogs corpus decodes ~25% faster
This commit is contained in:
parent
a015b42683
commit
4363f2d74b
@ -759,18 +759,29 @@ final class Decode {
|
|||||||
state.runningState = COPY_LOOP;
|
state.runningState = COPY_LOOP;
|
||||||
// fall through
|
// fall through
|
||||||
case COPY_LOOP:
|
case COPY_LOOP:
|
||||||
for (; state.j < state.copyLength;) {
|
int src = (state.pos - state.distance) & ringBufferMask;
|
||||||
ringBuffer[state.pos] =
|
int dst = state.pos;
|
||||||
ringBuffer[(state.pos - state.distance) & ringBufferMask];
|
int copyLength = state.copyLength - state.j;
|
||||||
// TODO: condense
|
if ((src + copyLength < ringBufferMask) && (dst + copyLength < ringBufferMask)) {
|
||||||
state.metaBlockLength--;
|
for (int k = 0; k < copyLength; ++k) {
|
||||||
state.j++;
|
ringBuffer[dst++] = ringBuffer[src++];
|
||||||
if (state.pos++ == ringBufferMask) {
|
}
|
||||||
state.nextRunningState = COPY_LOOP;
|
state.j += copyLength;
|
||||||
state.bytesToWrite = state.ringBufferSize;
|
state.metaBlockLength -= copyLength;
|
||||||
state.bytesWritten = 0;
|
state.pos += copyLength;
|
||||||
state.runningState = WRITE;
|
} else {
|
||||||
break;
|
for (; state.j < state.copyLength;) {
|
||||||
|
ringBuffer[state.pos] =
|
||||||
|
ringBuffer[(state.pos - state.distance) & ringBufferMask];
|
||||||
|
state.metaBlockLength--;
|
||||||
|
state.j++;
|
||||||
|
if (state.pos++ == ringBufferMask) {
|
||||||
|
state.nextRunningState = COPY_LOOP;
|
||||||
|
state.bytesToWrite = state.ringBufferSize;
|
||||||
|
state.bytesWritten = 0;
|
||||||
|
state.runningState = WRITE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (state.runningState == COPY_LOOP) {
|
if (state.runningState == COPY_LOOP) {
|
||||||
|
Loading…
Reference in New Issue
Block a user