Avoid preallocating buffers in buffer, tee #438
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instead of allocating buffers at construction time, allocate buffers
before pushing or cloning. This adds additional instructions on the fast
path for input/buffer/exchange/tee, but seems to be justified by the
memory savings.
We expect a linear amount of memory savings per operator in the number of workers. For non-serializing allocators, this memory saving will persist during the lifetime of the instance, for returning (serializing) allocators, the memory savings will remain until the first data is sent.
The exchange benchmark does not report a change in performance.
The main question that we'd need to answer is whether we're comfortable with
Message::push_atnot ensuring that the returned object is allocated. With current Timely, this moves the burden of ensuring allocations to clients ofpush_at, which is not great. Considering #426, this problem would disappear (somewhat) because containers would be responsible for their own buffer management. We could delay this PR until after #426 lands