mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-20 08:22:19 +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
|
@ -104,7 +104,7 @@ ErrorOr<u32> CanonicalCode::read_symbol(LittleEndianInputBitStream& stream) cons
|
|||
u32 code_bits = 1;
|
||||
|
||||
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))
|
||||
return Error::from_string_literal("Symbol exceeds maximum symbol number");
|
||||
|
||||
|
|
Loading…
Reference in a new issue