A technical blog post examines how GCC translates C switch statements into machine code, going beyond simple decision trees. It shows GCC building jump tables for compact case values, including cases offset by a constant, and notes that most of these optimizations also apply to clang except for one technique called bitset lowering.
xoranth.net
· 2026-10-31
A developer building a floating-point library needed a function returning the lowest set bit of a float's mantissa, but the straightforward bitwise algorithm failed on powers of two, requiring a slow conditional branch. Unable to find a branch-free formula by hand, they built a brute-force search that tests short sequences of integer operations against representative test cases, adding counterexamples when a candidate formula fails.
purplesyringa.moe
· 2026-10-16
A blog post details how profile-guided optimization (PGO) works in its second installment, describing a two-pass compilation process where an instrumented first build records per-edge counters across branches, loops, and call sites. The author explains how these fine-grained counts feed into the compiler's second-pass decisions, starting with inlining choices that can override static size and cost heuristics based on actual execution frequency.
percona.com
· 2026-10-14
A 2013 article originally published in Programista magazine (issue 4/2013) discusses techniques for writing high-performance C++ code, emphasizing that choosing a native language alone does not guarantee efficiency. The piece outlines why C++ occupies a middle ground between high-level convenience and low-level hardware access, citing manual memory management and lack of a garbage collector as key differentiators from managed languages.
asawicki.info
· 2026-09-25