From: Timo Sirainen Date: Tue, 10 Nov 2020 14:10:05 +0000 (+0200) Subject: login-proxy: Use persistent istream buffers X-Git-Tag: 2.3.14.rc1~286 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=30c453c8d975944e3784dffa80240d6c22c8b536;p=thirdparty%2Fdovecot%2Fcore.git login-proxy: Use persistent istream buffers Constantly freeing and allocating the memory is a bit slow, but because Dovecot allocates all memory with calloc() the memory cleaing is especially slow. With this change proxying lots of data in a plaintext connection takes about 50% less CPU. The downside is that it uses about 4 kB more memory per istream (8 kB total, for both client and server connections), but that shouldn't be too bad for proxies since they don't use much memory otherwise. --- diff --git a/src/login-common/login-proxy.c b/src/login-common/login-proxy.c index 53c4f9bf08..81255c7477 100644 --- a/src/login-common/login-proxy.c +++ b/src/login-common/login-proxy.c @@ -707,8 +707,6 @@ void login_proxy_detach(struct login_proxy *proxy) proxy->client_input = client->input; proxy->client_output = client->output; - i_stream_set_persistent_buffers(proxy->server_input, FALSE); - i_stream_set_persistent_buffers(client->input, FALSE); o_stream_set_max_buffer_size(client->output, PROXY_MAX_OUTBUF_SIZE); client->input = NULL; client->output = NULL;