mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:37:34 +00:00
LibCompress: Speed up deflate decompression by ~11%
...simply by using LittleEndianInputBitStream::read_bit() instead of read_bits(1). This puts us on the fast path for single-bit reads. There's still lots of money on the table for bigger optimizations to claim here, just picking an embarrassingly low-hanging fruit. :^)
This commit is contained in:
parent
ea9707ec29
commit
aeb8224ec8
1 changed files with 1 additions and 1 deletions
|
@ -104,7 +104,7 @@ ErrorOr<u32> CanonicalCode::read_symbol(LittleEndianInputBitStream& stream) cons
|
||||||
u32 code_bits = 1;
|
u32 code_bits = 1;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
code_bits = code_bits << 1 | TRY(stream.read_bits(1));
|
code_bits = code_bits << 1 | TRY(stream.read_bit());
|
||||||
if (code_bits >= (1 << 16))
|
if (code_bits >= (1 << 16))
|
||||||
return Error::from_string_literal("Symbol exceeds maximum symbol number");
|
return Error::from_string_literal("Symbol exceeds maximum symbol number");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue