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:
Lucas CHOLLET 2023-07-10 00:24:00 -04:00 committed by Tim Flynn
parent d2637d54e5
commit 44bedf7844

View file

@ -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));
}
}