swift-nio/dev
George Barnett 4dfae01cc6
Add a pooled recv buffer allocator (#2362)
Motivation:

Channels can read `ChannelOptions.maxMessagesPerRead` times from a
socket in each read cycle. They typically re-use the same buffer for
each read and rely on it CoWing if necessary. If we read more than once
in a cycle then we may CoW the buffer. Instead of reusing one buffer we
can reuse a pool of buffers limited by `maxMessagesPerRead` and cycle
through each, reducing the chance of CoWing the buffers.

Modifications:

- Extend `RecvByteBufferAllocator` to provide the size of the next
  buffer with a default implementation returning `nil`.
- Add an recv buffer pool which lazily grows up to a fixed size and
  attempts to reuse buffers where possible if doing so avoids CoWing.

Results:

Fewer allocations
2023-02-20 17:00:19 +00:00
..
alloc-limits-from-test-output dev/scripts: add missing license headers (#1852) 2021-05-07 10:28:07 +01:00
boxed-existentials.d add useful dtrace scripts to debug allocations (#352) 2018-04-25 15:23:09 +01:00
generate-bytebuffer-multi-int.sh ByteBuffer: provide multi read/write int methods (#1987) 2021-11-22 14:58:52 +00:00
git.commit.template Adapt git template that is also used by Netty 2018-02-09 12:19:12 +01:00
lldb-smoker dev/scripts: add missing license headers (#1852) 2021-05-07 10:28:07 +01:00
make-single-file-spm make-single-file-spm: better directory name (#1446) 2020-03-13 17:01:37 +00:00
malloc-aggregation.d alloc tests: implement malloc_zone_* (#1569) 2020-06-26 11:04:37 +01:00
stackdiff-dtrace.py Script to list transitive dependencies (#2082) 2022-04-20 14:39:43 +01:00
update-alloc-limits-to-last-completed-ci-build Add a pooled recv buffer allocator (#2362) 2023-02-20 17:00:19 +00:00