Virtual Function Costs
Measuring real performance cost of C++ virtual functions: vtable lookup overhead, branch misprediction, devirtualization, and when to avoid virtual dispatch.
Measuring real performance cost of C++ virtual functions: vtable lookup overhead, branch misprediction, devirtualization, and when to avoid virtual dispatch.
Techniques for type dispatch in C++: tag dispatch, if constexpr, std::variant with std::visit, and how to choose the right approach for your use case.
Practical techniques to resolve C/C++ macro name collisions between system headers and user code: undef, parenthesization, and inline function workarounds.
A surprisingly valid C++ technique to access private class members using explicit template instantiation, with analysis of what the standard actually permits.
How to elegantly dispatch from runtime values to compile-time types in C++ using techniques like std::variant, type lists, and template metaprogramming.
Three classical popcount algorithms: from naive bit-twiddling to the Hamming weight trick, plus how modern CPUs accelerate it with POPCNT and AVX-512.
A detailed walkthrough of how C++ virtual table of tables (VTT) works for classes with virtual base classes, with concrete memory layout examples.
Visual walkthrough of C++ object memory layout: member ordering, padding, base class subobjects, vtable pointers, and how multiple inheritance affects layout.
A deep dive into a subtle C++ performance bug: why over-aligned dynamic memory allocation was undefined before C++17 and how alignas interacts with operator new.
Deep dive into NanoLog, an extremely fast C++ logging library: how it achieves nanosecond-scale latency with lock-free queues and cache-line alignment.