[core] tweak buffer merging to reduce mem

tweak buffer merging in chunkqueue_append_buffer() to trade off
a slight increase in copying for slightly more constrained mem usage
master
Glenn Strauss 1 year ago
parent d958cf3262
commit 3f17f94336
  1. 3
      src/chunk.c

@ -375,7 +375,8 @@ static int chunkqueue_append_mem_extend_chunk(chunkqueue * const restrict cq, co
void chunkqueue_append_buffer(chunkqueue * const restrict cq, buffer * const restrict mem) {
chunk *c;
size_t len = mem ? buffer_clen(mem) : 0;
if (len < 256 && chunkqueue_append_mem_extend_chunk(cq, mem->ptr, len)) return;
if (len < 1024 && chunkqueue_append_mem_extend_chunk(cq, mem->ptr, len))
return;
c = chunkqueue_append_mem_chunk(cq, chunk_buf_sz);
cq->bytes_in += len;

Loading…
Cancel
Save