mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
AK+LibCompress: Remove the Deflate back-reference intermediate buffer
Instead of reading bytes from the output stream into a buffer, just to immediately write them back out, we can skip the middle-man and copy the bytes directly into the output buffer.
This commit is contained in:
parent
9f238793e0
commit
8b56d82865
3 changed files with 19 additions and 3 deletions
|
@ -207,9 +207,7 @@ ErrorOr<bool> DeflateDecompressor::CompressedBlock::try_read_more()
|
|||
m_decompressor.m_output_buffer.write({ &byte, sizeof(byte) });
|
||||
}
|
||||
} else {
|
||||
Array<u8, DeflateDecompressor::max_back_reference_length> buffer;
|
||||
auto bytes = TRY(m_decompressor.m_output_buffer.read_with_seekback({ buffer.data(), length }, distance));
|
||||
m_decompressor.m_output_buffer.write(bytes);
|
||||
TRY(m_decompressor.m_output_buffer.copy_from_seekback(distance, length));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue