Optimized port communication for scalar types #17
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.
In reactor-cpp, every value relayed via ports and stored in actions is wrapped in a value ptr. The value ptr itself is a wrapper around the smart pointers of the stdlib and extends it by control for mutability. However, a smartpointer adds a small (but still significant) overhead if simple data types such as scalar values are used. This PR provides two different template specializations that implement the value ptr interface. The old one (based on smart pointers) is only used for non-scalar types. For all scalar types, a new optimized specialization is added that simply stores the value directly instead of using a smartpointer.
On my laptop, this improved performance of the RadixSort benchmark by about 1.7x. Other benchmarks likely also benefit from the change, but maybe not as much.