Necessary Maintenance #5281
Move to using make_shared() wherever possible and appropriate.
make_shared(), when used consistently in preference to
shared_ptr<>(new ...), is significantly faster. Where it is straightforward to do, we should do this.
#2 Updated by Christopher Green about 7 years ago
- Status changed from New to Accepted
- Priority changed from Normal to Low
- Estimated time set to 8.00 h
This is a, "low-hanging fruit" issue, making the code conform to current best practice and getting a performance improvement into the bargain. Basically the idea is to take advantage of the fact that
make_shared allocates the memory for the reference counter contiguous with the saved object, and reducing the number of unnecessary
shared_ptr copies by using references reduces the churn on the reference counter, thereby also improving performance. If experiments wish to do this in their own code there should be no issues with respect to whether or not art does the same thing (or vice versa).