You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: