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.
Bytes
currently has both a “Vec” and “shared” representation, lazily upgrading the former to the latter. I believe that originally, the “Vec” representation allowed for excess capacity, but now it only works whenlen == cap
. Given that it only saves one heap allocation, which is probably made anyway most of the time (it’s made whenever one does.split
,.truncate
,.clone
etc), I would like to know how worth it it actually is.The main benefit of removing it would probably be the removal of atomics, meaning it might have a bigger performance impact on ARM. But I don’t have an ARM machine, so if someone could run some benchmarks (Hyper or Tonic or something) on ARM – ideally multithreaded ones – that would be appreciated.
Maybe there’s a use case for this optimization I’m missing. I find that pretty rare to be using
Box<[u8]>
so I’m somewhat doubtful.This PR is very much unfinished, I just creäted for initial feedback on the idea, and benchmarking purposes.