mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-02 22:24:26 +00:00
AK: Don't reuse chunks in AllocatingMemoryStream
As confusing as it may sound, reusing them is terrible performance wise. When profiling the PNG decoder, the result (which is dominated by the Zlib decompression) shows that the `cleanup_unused_chunks()` function represented 14.26% of the profile before this patch and only 7.7% afterward. On a 6.5 MB PNG image, it reduces the decompression time by more than 5%.
This commit is contained in:
parent
d2637d54e5
commit
44bedf7844
|
@ -277,8 +277,6 @@ void AllocatingMemoryStream::cleanup_unused_chunks()
|
|||
auto buffer = m_chunks.take_first();
|
||||
m_read_offset -= CHUNK_SIZE;
|
||||
m_write_offset -= CHUNK_SIZE;
|
||||
|
||||
m_chunks.append(move(buffer));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue