Skip to content

Commit bda8f17

Browse files
committed
Read ahead chunk body if previous chunk was small enough
Reading a chunk header then using the sendfile syscall to send the chunk data is not optimal for small chunks, as it amounts to 2 system calls for a small amount of bytes. This commit uses the size of the last chunk to try to read the whole chunk when the library reads the chunk header. If the last chunk data size was under 4096 bytes, the library does not only read the chunk header, but reads ahead to try to read the whole and thus to save the sendfile call later. This optimization should improve the read throughput for streams with small chunks, e.g. streams with 1-message chunks.
1 parent 2ba5a21 commit bda8f17

File tree

2 files changed

+416
-161
lines changed

2 files changed

+416
-161
lines changed

0 commit comments

Comments
 (0)