r/programminghumor • u/Bubbly_Rain7858 • Jun 13 '26
How to REALLY optimize code.
My friends, this is how you optimize code correctly.
97
Upvotes
r/programminghumor • u/Bubbly_Rain7858 • Jun 13 '26
My friends, this is how you optimize code correctly.
View all comments
Show parent comment
5
u/thisisjustascreename Jun 13 '26
Broadly, it eliminates certain scenarios where you'd get a copy.
A const ref can also bind to a temporary (i.e. doSomething("temporary string"); ) without constructing a new object, but I don't know if that's relevant here.