Skip to content

Commit

Permalink
Optimize inner loop in inflt (#180)
Browse files Browse the repository at this point in the history
This made decompressing small data (~1kb) 3% faster for me with Chrome 115.
  • Loading branch information
karyon committed Sep 3, 2023
1 parent e81b3e5 commit 1a7a484
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,9 @@ const inflt = (dat: Uint8Array, st: InflateState, buf?: Uint8Array, dict?: Uint8
if (shift + bt < 0) err(3);
for (; bt < dend; ++bt) buf[bt] = dict[shift + bt];
}
for (; bt < end; bt += 4) {
for (; bt < end; bt++) {
buf[bt] = buf[bt - dt];
buf[bt + 1] = buf[bt + 1 - dt];
buf[bt + 2] = buf[bt + 2 - dt];
buf[bt + 3] = buf[bt + 3 - dt];
}
bt = end;
}
}
st.l = lm, st.p = lpos, st.b = bt, st.f = final;
Expand Down

0 comments on commit 1a7a484

Please sign in to comment.