Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimized port communication for scalar types #17

Merged
merged 8 commits into from
Jul 15, 2022
Merged

Optimized port communication for scalar types #17

merged 8 commits into from
Jul 15, 2022

Conversation

cmnrd
Copy link
Contributor

@cmnrd cmnrd commented Jul 14, 2022

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.

@cmnrd cmnrd added the enhancement Enhancement of existing feature label Jul 14, 2022
@cmnrd cmnrd requested a review from tanneberger July 14, 2022 14:53
@tanneberger
Copy link
Member

tanneberger commented Jul 14, 2022

I ran every test locally everything worked and the changes looked fine to me.

@cmnrd cmnrd merged commit 14b2281 into master Jul 15, 2022
@cmnrd cmnrd deleted the value-ptr branch July 15, 2022 08:37
cmnrd added a commit to lf-lang/lingua-franca that referenced this pull request Jul 15, 2022
@lhstrh lhstrh changed the title Optimize port communication for scalar types Optimized port communication for scalar types Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants