cppbestpractices icon indicating copy to clipboard operation
cppbestpractices copied to clipboard

Consider adding Compiler Explorer links to Considering Performance chapter

Open samkellett opened this issue 6 years ago • 2 comments

A counter point to the std::bind section seems to prove there isn't a runtime overhead for the example given: https://godbolt.org/g/ZcUgRr

samkellett avatar Mar 17 '18 10:03 samkellett

  • Ternary operator (it's actually shocking how bad the had version is): https://godbolt.org/g/6bALYs
  • Self calling lamdba (again, bad is really bad): https://godbolt.org/g/rGhTSX
  • Initializer lists: https://godbolt.org/g/cvfZxs etc..

samkellett avatar Mar 17 '18 10:03 samkellett

The code size difference for the ternary operator and self-calling lambda examples isn't nearly as big if you compile with C++11 or C++14. The "bad" code size only explodes with C++17 for some reason.

jonvmey avatar Jan 07 '19 23:01 jonvmey