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.
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;