[core] perf: size write buffers for reuse
size write buffers for reuse in common cases (so that write buffers are BUFFER_MAX_REUSE_SIZE)
This commit is contained in:
parent
2e23b43d12
commit
5a159e828d
|
@ -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) {
|
||||
|
|
|
@ -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…
Reference in New Issue