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
Use std::make_shared to allocate shared ptrs, instead of std::shared_ptr constructors #556
Conversation
std::make_shared does in a single allocation what the constructors for std::shared_ptr usually take at least 2 allocations to do. May give us an infinitesimal performance/memory improvement. https://www.modernescpp.com/index.php/memory-and-performance-overhead-of-smart-pointer
Codecov Report
@@ Coverage Diff @@
## develop #556 +/- ##
===========================================
+ Coverage 48.77% 49.33% +0.56%
===========================================
Files 129 129
Lines 10036 10207 +171
===========================================
+ Hits 4895 5036 +141
- Misses 5141 5171 +30
Continue to review full report at Codecov.
|
Best reason not to narrate the code in the comments: The code gets changed, but the documentation doesn't.
LGTM! |
@jonoomph I decided to let Codacy shame me into fixing that initialization issue, and replace all of the redundant Frame constructors with delegating constructors. |
This one is going to have some conflicts with my new clip-refactor-keyframes branch, yikes. |
This might wait until after I merge |
Okay, I'm going to bite the bullet, merge this, and then merge develop back into my |
std::make_shared does in a single allocation what the constructors for std::shared_ptr usually take at least 2 allocations to do.
As you can see, the revised syntax is at worst as concise, and in some cases much more concise, than the previous code. And, doing this may give us an infinitesimal performance/memory improvement (though I don't expect it's measurable except in contrived benchmarks).
For said contrived benchmarks, see: https://www.modernescpp.com/index.php/memory-and-performance-overhead-of-smart-pointer