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

Update all shared_ptr value passes to be by ref or const ref #161

Closed
axsaucedo opened this issue Feb 22, 2021 · 0 comments · Fixed by #164
Closed

Update all shared_ptr value passes to be by ref or const ref #161

axsaucedo opened this issue Feb 22, 2021 · 0 comments · Fixed by #164

Comments

@axsaucedo
Copy link
Member

axsaucedo commented Feb 22, 2021

As outlined in https://stackoverflow.com/questions/2502394/the-cost-of-passing-by-shared-ptr?noredirect=1&lq=1 passing shared_ptr has a hidden cost which can end up resulting in a significant compound cost to the application.

Initially the use of shared_ptr was primarily as there was an assumption that there would be a shared ownership of objects, however now that the framework has matured further the ownership is managed by a single component for all the different aspects, and when it's passed across functions it's only shared but ownership is not explicitly transferred. Because of this, there could even be scope for the shared_ptr to be dropped completely in favour of passing by references, as this would improve performance in the long run significantly. Given that there is no implementation of copy constructor on any of the Kompute components, it would be required that all objects are always passed by reference, and where necessary, passing by smart pointer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant