On Wed, 29 May 2024 02:52:22 GMT, Yi Yang <yy...@openjdk.org> wrote: > I remember experimenting with different buffer sizes and figuring out that > 4KB was the sweet spot. We could potentially switch to 1MB, but it would be > better if we had some benchmark numbers to back that up.
My experiments shown that with the fix time of the merge decreased ~5%. But this is not just change of the buffer size: Before the fix merger (1) read `segment_fs` in 4K chunks, (2) wrote them (copying memory) to `_writer->_buffer` until the buffer is full (i.e. 256 read iterations) and then (3) flush `_writer->_buffer`; With the fix (1) and (2) are replaced with single reading of 1MB directly to `_writer->_buffer` (no memory copy). ------------- PR Comment: https://git.openjdk.org/jdk/pull/18850#issuecomment-2138238839