Browse Source

[core] perf: size write buffers for reuse

size write buffers for reuse in common cases
(so that write buffers are BUFFER_MAX_REUSE_SIZE)
personal/stbuehler/fix-fdevent
Glenn Strauss 4 years ago
parent
commit
5a159e828d
  1. 2
      src/chunk.c
  2. 4
      src/connections.c

2
src/chunk.c

@ -328,7 +328,7 @@ void chunkqueue_get_memory(chunkqueue *cq, char **mem, size_t *len, size_t min_s
/* default values: */
if (0 == min_size) min_size = 1024;
if (0 == alloc_size) alloc_size = 4096;
if (0 == alloc_size) alloc_size = 4095;
if (alloc_size < min_size) alloc_size = min_size;
if (NULL != cq->last && MEM_CHUNK == cq->last->type) {

4
src/connections.c

@ -971,8 +971,8 @@ static int connection_read_cq(server *srv, connection *con, chunkqueue *cq, off_
* if FIONREAD doesn't signal a big chunk we fill the previous buffer
* if it has >= 1kb free
*/
if (0 != fdevent_ioctl_fionread(con->fd, S_IFSOCK, &toread) || toread <= 4096) {
toread = 4096;
if (0 != fdevent_ioctl_fionread(con->fd, S_IFSOCK, &toread) || toread < 4096) {
toread = 4095;
}
else if (toread > MAX_READ_LIMIT) {
toread = MAX_READ_LIMIT;

Loading…
Cancel
Save