Re:A lot of complex “scalable” systems can be done with a si...
by wffurr on Monday December 30, 2019 @08:27AM
(#21913177)
Only use shared_ptr when you actually want shared ownership. If you stick to unique_ptr for owning references and then "borrow" that raw pointer in functions, then you get speed without sacrificing too much safety and still no new/delete.
Re:A lot of complex “scalable” systems can be done with a si...
by slavik81 on Monday December 30, 2019 @03:10PM
(#21916251)
Additionally, shared ownership should be rare. Most objects should have a single owner that is responsible for them. This is not only better for performance, but also makes the system easier to understand.
Re:A lot of complex “scalable” systems can be done with a si...
by paulddraper on Monday December 30, 2019 @03:18AM
(#21911665)
Yes shared_ptr is relatively expensive; avoid it in your inner loops, but know that it's there for the other 80% of your code.
Re:A lot of complex “scalable” systems can be done with a si...
by naniwaduni on Monday December 30, 2019 @01:08AM
(#21911193)
On the bright side, you didn't lose 200% of the frame time!
I used sharedptr extensively in a game engine. Whoops: suddenly 20% of the frame time was gone, never to be recovered. Once that performance is gone it’s almost impossible to get it back, short of rewriting every system.