March 7, 2026
Big O? Big Uh‑oh!
Overheads (2023)
Programmers feud over “hidden costs” — is anything truly fast
TLDR: A hot‑button post warned that “hidden costs” like garbage collection pauses, copy‑on‑write copying, and slow string indexing can bite performance. Commenters split: some demand constant‑time operations for “systems” languages, while others insist nothing is truly constant on modern hardware — making trade‑offs the real story.
An eyebrow-raising essay on “hidden costs” in programming lit up the comments, with the author calling out surprise slowdowns like garbage collector pauses (automatic memory cleanup), Swift’s “copy-on-write” trick that can silently duplicate big chunks of data, and even slow string indexing when dealing with emojis. The mood? Spicy.
One camp, echoing quuxplusone, boiled it down to a bold line: systems languages should promise predictable speed — “no built‑in operation should take more than O(1)” (tech-speak for constant time). But the pushback was immediate. sunday_serif waved the reality flag, pointing out that on modern hardware “nothing is really O(1)”, and linked the classic “C is not a low level language” reminder. Cue a side-drama over a “brief misstep” about stack memory allegedly being O(n), which sent the pedants into overdrive.
Meanwhile, Panzerschrek came in hot defending Swift’s copy‑on‑write: it’s deterministic, easy to reason about, and way more predictable than garbage collection breathers. The commentariat turned comedic: “O(1) is a myth” memes, jokes about Swift “smiling while secretly copying gigabytes,” and mock headlines like “Big O Betrayal.” It’s the classic internet split — performance purists clutching their benchmarks vs. pragmatists saying real machines don’t care about your textbook proofs. Result: chaos, laughs, and surprisingly good points on both sides.
Key Points
- •Garbage collection introduces pauses that interrupt program execution, a key reason GC languages are seen as unsuitable for systems programming.
- •Swift’s standard collections are value types implemented with copy-on-write, deferring copies until mutation.
- •Copy-on-write can make simple-looking mutations trigger large data copies, representing a hidden performance cost.
- •UTF-8’s variable width means indexing by user-perceived characters (extended grapheme clusters) is O(n), not O(1).
- •Swift indexes strings by extended grapheme clusters for usability, a trade-off beneficial in UI contexts but misaligned with systems programming needs.