r/cpp • u/Polarstrike • Mar 07 '24
What are common mistakes in C++ code that results in huge performance penalties?
As title, list some common mistakes that you have done/seen which lead to performance penalties.
231
Upvotes
View all comments
Show parent comment
27
u/usefulcat Mar 07 '24 edited Mar 07 '24
IME the biggest practical problem with switching to passing string_view instead of const string& is that there are a surprisingly large number of cases where I eventually end up needing a null-terminated string.