January 13, 2026

Delete comments for turbo mode?

Inlining – The Ultimate Optimisation

Coders brawl over copy‑paste speed trick, with “delete comments” memes flying

TLDR: Inlining copy-pastes tiny functions into your code, letting the compiler speed things up by removing extra work. The comments erupt over whether to trust the compiler’s guesses or force it with “inline everything,” with memes about deleting comments for speed and debates on object‑oriented patterns blocking inlining.

Inlining is the compiler’s “copy‑paste for speed” move—stick a small helper right into your code so calls disappear and other optimizations light up. The post shows how the compiler inlines a case‑changing function, then strips out the unused path and turns lowercase into uppercase super fast. But the crowd doesn’t just nod; they argue. Some warn that too much inlining bloats apps, and it’s all guided by guesswork. Others say it’s worth it if it unlocks more wins. Remember day 8? That vibe, but louder.

Then the drama kicks in. jayd16 asks if there’s a name for duplicating functions so each gets its own optimization—cue a side‑quest: “function cloning,” “multiversioning,” and “code versioning” all get shout‑outs. hinkley drops a bomb: a wild era when JavaScript ran faster if you deleted comments, sparking memes about engineers putting their docs on a “comment diet.” on_the_train reignites the eternal flame war: fancy object‑oriented patterns aren’t “slow,” they just stop inlining—so alternatives can sometimes “compile to zero.” Meanwhile, mgaunard champions the nuclear option: force‑inline everything and use “flatten,” lamenting that Microsoft’s compiler doesn’t have it. It’s Team Trust The Compiler vs Team Smash The Inline Button, with jokes, receipts, and surprisingly strong feelings about… copying code.

Key Points

  • Inlining is presented as a foundational compiler optimization that now mainly enables further optimizations beyond avoiding call overhead.
  • An example shows std::vector::size being inlined so no function call appears in assembly.
  • In an ARMv7 example, inlining change_case into make_upper allows constant propagation (upper is always true) and code simplification.
  • The resulting assembly uses a branchless check to detect lowercase characters and conditionally subtracts 32 to convert to uppercase.
  • Inlining has trade-offs: it can increase code size, decisions are heuristic, branch prediction interactions are nuanced, and inlining requires visibility of function definitions; LTO can help.

Hottest takes

"code that would go faster if you deleted the comments" — hinkley
"It’s not the polymorphism is slow. It’s that alternatives can sometimes compile to zero" — on_the_train
"force inline and related attributes are critical to get the right decision made consistently" — mgaunard
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.