Cleaned up memory dance in ipc::send and ipc::to. #421
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.
After this discussion (https://servo.zulipchat.com/#narrow/channel/263398-general/topic/IPC-Channel.20question/with/545510321)
and my own understanding the memory dance done does not seem to be necessary.
Additionally, we can replace the uses of std::mem with methods on the RefCell which makes the code cleaner and easier to understand. I also added some comments that future people are not confused why we handle memory in a thing that should serialize.
This might increase performance by a bit as my tests show 1-24% increase in the bench with most in the single digit. I noticed regressions
that seem to be just outliers as the surrounding benchmarks are fine.
On constraint devices this might be more of an increase in performance (15-42%) but these devices are very noisy.
Testing:
The included tests still work and a whole run of servospeedometer with this version of ipc-channel still worked. All of these tests were only done on Linux but it should be independent.
Signed-off-by: Narfinger [email protected]