3 ms·
wow, I never knew that, crazy
by adamrezich 5y ago
wow, I never knew that, crazy
- jeffbee 5y agoThis example is trivial but compilers are generally very good at de-virtualizing at compile time even in large programs. People who bring up the supposed cost of vtable dispatch are usually either repeating bad folk wisdom, or haven't used the language since 20 years ago.
- adamrezich 5y agoseems to me like the real problem is the burden of knowledge required to intuit how C++ compilers will or won't optimize the code you write. I know this has been an ongoing refrain for years now but this sort of thing has driven me away from using C++ personally. I wish there was a better syntactic system for denoting where you do and don't want certain optimizations to be applied.
- jcelerier 5y agodo you also wonder where the JVM or .net runtime will inline method calls ?
- adamrezich 5y agono because those are explicitly "Managed" systems