AI summaryThe author announces the Advent of Microarchitecture 2026, a YouTube series in lieu of the previous Advent of Compiler Optimisations, which was too time-consuming (about 10 hours per episode) to produce again. The new series consists of low-effort, ad-libbed videos recorded straight to camera with minimal editing, some help from an LLM, and as much automation as possible. The introduction video is already available, and daily videos will be released each morning throughout December.
AI summaryThe author recounts recreating a fun 2010 experiment from their Google days, when they hooked a BBC Master up as a dumb terminal over serial to browse the web, jokingly claiming to be the only person who googled Google on a BBC Micro from inside Google. Since Google no longer supports non-JavaScript browsers like lynx, they used DuckDuckGo's lite mode at home, working around cabling mistakes, the inadequate built-in *TERMINAL program, and baud rate limits to get the setup running with the Acornsoft Termulator ROM. Along the way they also improved jsbeeb's audio and video emulation using feedback from their PALindrome PAL decoder, making it more authentic even if it sounds and looks objectively worse.
AI summaryThe article describes how Compiler Explorer runs on AWS in 2026: browser traffic goes through CloudFront and WAF to a single Application Load Balancer that routes to blue/green auto-scaling fleets of mostly cheap spot instances, while its roughly 6,000 never-deleted compiler binaries across 93 languages are stored on EFS using a custom content-addressed image system (CEFS) that cut startup times dramatically. Nightly compiler builds run on self-hosted GitHub Actions EC2 runners, a partially deployed 'CE Router' will eventually decouple HTTP handling from compilation, and services like DynamoDB, S3, and Lambda handle short links, caching, and odds and ends. The site handled 78.7 million compilations over the past year at around $3,600 per month (about $0.0007 per compilation), costs largely covered by AWS open source credits and sponsors, though traffic has been sliding for reasons the author can't fully explain since the site deliberately doesn't track users.
AI summaryThe author, Matt, recounts interviewing himself with Claude (dictating via voice-to-text) during a dog walk about the gap between accurate-but-impenetrable technical content and polished-but-slightly-wrong material. He discusses his explanation philosophy—including his 'tell my mum' test, childhood mental models from Usborne books, and the real costs in hours or conceptual distillation that explain his infrequent video output—and admits his motivations range from showing off to the joy of someone finally understanding. He concludes that Compiler Explorer shares the same impulse as his videos and talks, and notes that the LLM-as-interviewer experiment sent him home with a new thought, which is more than most dog walks achieve.
AI summaryIn his 2025 year-in-review, Matt Godbolt recounts a busy year featuring numerous conference talks and keynotes, appearances in Computerphile videos, and Compiler Explorer milestones such as solving the CEFS mounting problem and launching the experimental Claude Explain feature. He also kept up his monthly Two's Complement podcast, appeared in a Tom7 video, and produced a 27-video Advent of Code Optimisation YouTube series. The year ended with him starting a new job at Hudson River Trading, where he is delighted with the technology, interesting problems, and kind colleagues.
AI summaryThis final post of Matt Godbolt's Advent of Compiler Optimisations 2025 series, published on the 25th, offers holiday wishes and reflects on the substantial work involved in producing the 25-day series on compiler optimizations, noting possible future follow-ups if time allows. He thanks numerous contributors—including Jason Turner, his reviewers and video-production mentors, compiler maintainers, Compiler Explorer's patrons and volunteer team, and especially his wife Ness—for their support throughout the project.
AI summaryMatt Godbolt describes being surprised by compiler optimizations when examining how GCC and clang compile a simple loop that sums integers up to a given value. While GCC cleverly processes two numbers per iteration using the observation that x + (x+1) equals 2x + 1, clang goes further and eliminates the loop entirely, algebraically deriving the closed-form solution v(v-1)/2 and turning the O(n) algorithm into O(1). The author reflects on how, even after twenty years of working with compilers, he remains amazed and inspired by their sophistication.
AI summaryThis article by Matt Godbolt explains that switch statements don't always compile to jump tables; compilers instead employ cleverer strategies when possible, such as arithmetic formulas for dense cases with predictable relationships, built lookup tables, bitmasks for sparse inputs like whitespace detection, and binary-search-style comparisons when tables aren't feasible. The author encourages programmers to write clear switch statements and trust the compiler to choose the most efficient optimization, noting that different compilers use quite different tricks.
AI summaryThis article by Matt Godbolt, part of the Advent of Compiler Optimisations 2025 series, examines how Clang compiles comparisons of a std::string_view against compile-time string constants, inlining and specialising the code instead of calling memcmp. For power-of-two lengths it emits simple length checks followed by direct byte/word comparisons, while for other lengths like seven it uses overlapping 32-bit reads, XOR operations against the constant, and a branchless sete instruction to produce the result. The author concludes that modern compilers apply these clever transformations automatically, so programmers should write clear code and let the compiler make it fast.
AI summaryThe article explains how compilers can auto-vectorize integer array summation using SIMD, but decline to do the same for floating-point sums because float addition is not associative—rounding after each operation means regrouping the additions changes the result. Global flags like -Ofast or -funsafe-math-optimizations can force vectorization but have program-wide side effects, so the author recommends a targeted GCC function annotation to permit reassociation only in the specific function. Understanding these floating-point quirks helps developers cooperate with the compiler to produce fast vectorized code.
AI summaryThe article explains auto-vectorisation, a compiler optimisation that transforms simple element-wise loops into SIMD instructions that process multiple data elements at once, given the right flags (-O3 and a suitable -march target). Using an integer max-update example, it demonstrates how compilers use masked moves for conditional writes, can replace ternary logic with built-in vector 'max' instructions, and generate a fallback non-vectorised loop when arrays might overlap in memory. It concludes that with appropriate compiler flags and careful data layout, developers can let the compiler turn scalar loops into efficient batch-processing code.
AI summaryThis article explains tail call optimisation (TCO), where compilers transform a function that ends by calling another function (including itself) into a jump instead of a call, effectively converting recursive routines like GCD into loops and saving stack space. It describes Clang's [[clang::musttail]] annotation for guaranteeing tail calls, notes that arranging arguments in the same order as parameters makes TCO more efficient, and highlights a niche use in CPU emulators where TCO replaces a single switch-statement branch with per-instruction branches that give the CPU's branch predictor much better information.
AI summaryThe article explains partial inlining, a compiler optimisation in which the compiler splits a function into a thin wrapper handling a cheap fast path and an outlined separate function (e.g., process.part.0) containing the expensive cold path. When the function is later inlined, only the lightweight wrapper and fast-path checks are duplicated at call sites, while calls go to the shared outlined cold path, giving inlining's performance benefits without the full code-bloat cost. Using GCC assembly examples, the author shows how this works in practice and notes that compilers apply such heuristics differently, so it's worth inspecting hot code paths in tools like Compiler Explorer.
AI summaryThis article, part of a series on compiler optimizations, explains that inlining—copying a function's body into its call sites—is valuable less for avoiding call overhead and more for enabling further optimizations like constant propagation and dead code elimination, illustrated with an ARMv7 example of converting a string to uppercase. It also covers inlining's drawbacks, such as increased code size, the heuristics compilers use to decide when to inline, and the requirement that the function's definition be visible. The author concludes that inlining is the ultimate enabling optimization, giving the compiler a fresh copy of code to transform in ways impossible with a shared function body.
AI summaryThe article explores calling conventions, part of the ABI, focusing on the System V ABI for x86 Linux, where the first few parameters are passed in registers like rdi and rsi, and small structures can be efficiently packed into single registers. It demonstrates that once more than six parameters are used, arguments spill to the stack, though cleverly designed structs (e.g., of chars) can avoid this. Understanding these conventions helps developers make informed design decisions about parameter passing and type layout, such as with register-friendly types like std::string_view.
AI summaryThe article explains how pointer aliasing blocks compiler optimizations in C++, using a Counter class example where accumulating into an int member forces redundant memory stores each loop iteration, while accumulating into a long lets the compiler keep the value in a register because strict aliasing rules guarantee no overlap with the int span. It suggests fixes such as accumulating in a local variable (e.g., via std::accumulate) or using the non-standard __restrict extension to promise unique pointer access. The author encourages using Compiler Explorer to spot unexpected memory writes that reveal aliasing-related lost optimizations.
AI summaryThis article, part of Matt Godbolt's 'Advent of Compiler Optimisations 2025' series, shows how loop-invariant code motion (LICM) can fail: incrementing a global counter inside a string-scanning loop forces the compiler to re-call strlen on every iteration. The reason is aliasing—char* may legally alias any object under the C++ standard, so the compiler cannot assume writing the global doesn't modify the string. The author notes that GCC, Clang, and MSVC all miss this optimization even for non-char types, and previews upcoming posts on helping compilers deal with aliasing.
AI summaryThis article, part of the Advent of Compiler Optimisations 2025 series, explains Loop-Invariant Code Motion (LICM), an optimisation where the compiler hoists calculations that don't change between iterations—such as vec.size() or a pure get_range() call—out of a loop. The author shows via assembly how clang successfully performs this transformation with clever branchless tricks, but is surprised that GCC fails to do so in the example, apparently because a returned std::pair doesn't undergo common subexpression elimination. The takeaway: trust the compiler, but know how to verify its output with tools like Compiler Explorer.
AI summaryThe article explains 'loop unswitching', a compiler optimisation in which a loop-invariant condition (like a boolean flag) is hoisted out of a loop, causing the compiler to duplicate the loop into specialised versions—one that always performs the operation and one that never does. Using a sum/sum-of-squares example on ARMv7, the author shows that at -O2 the compiler keeps a branchless conditional multiply-and-add inside the loop, while at higher optimisation levels it duplicates the loop, trading code size for speed. The takeaway is to trust the compiler's decisions while understanding the trade-offs it makes at different optimisation levels, which can be verified with tools like Compiler Explorer.
AI summaryThis article explores the population count operation—counting the one bits in an integer—and shows a classic C implementation using the trick of clearing the lowest set bit with value &= value - 1. It demonstrates that when compiled with a modern target like -march=westmere, compilers such as gcc and clang can recognize the loop and replace it with a single hardware popcnt instruction, though using std::popcount in C++ is the more reliable way to guarantee that instruction. The post is part of Matt Godbolt's 'Advent of Compiler Optimisations 2025' series.