Skip to content
DevMeme
5358 of 7590
Performance Post #5875 · source on Telegram

Elegant theory, pure code, atrocious runtime: when Big-O meets prod reality

Description

Black-on-white scan of a textbook section heading that reads “7. Performance and complexity”. Beneath it the paragraph states, line by line: “The implementation is brief. The code is pure. The theory is elegant. So, how does this perform in practice? In brief, it is awful.” Visually it’s plain LaTeX‐style serif text with bold section number, no images or color. Technically it lampoons the classic gap between algorithmic elegance taught in academia and the harsh constant-factor and cache-miss realities senior engineers face when the input size hits production. The joke resonates with anyone who has watched a beautifully recursive O(n log n) turn into a page-fault festival once real-world data and hardware counters enter the chat

Comments

15
Anonymous ★ Top Pick Turns out the asymptotic complexity was fine - our professor just forgot to include the constant C that equals ‘pain in milliseconds per element’
  1. Anonymous ★ Top Pick

    Turns out the asymptotic complexity was fine - our professor just forgot to include the constant C that equals ‘pain in milliseconds per element’

  2. Anonymous

    This reads like every paper review I've written after implementing a 'groundbreaking' algorithm from SIGGRAPH - turns out O(n log n) with a constant factor of 10^6 and zero cache locality isn't quite production-ready, but hey, at least the proofs were beautiful

  3. Anonymous

    This reads like every Haskell paper's performance section, or that moment when your beautifully recursive, mathematically pure solution gets benchmarked against a dirty for-loop with mutable state and loses by three orders of magnitude. Turns out 'elegant' and 'fast' have an inverse relationship in production - who knew the compiler doesn't award style points?

  4. Anonymous

    Asymptotically elegant, but the constants are malloc-per-iteration, cold caches, and a crying branch predictor - SLOs call it O(pager)

  5. Anonymous

    Theory scales to n=∞; practice stalls at n=10k because 'constants don't matter' lied

  6. Anonymous

    Big‑O looks great; big‑oh‑no is the constant factor - cache misses, branch mispredicts, and a GC cameo in the hot path

  7. @ZgGPuo8dZef58K6hxxGVj3Z2 2y

    As always /s

  8. @marogatari 2y

    If it works, it is decently good.

  9. dev_meme 2y

    And memory efficient?

    1. @ZgGPuo8dZef58K6hxxGVj3Z2 2y

      Yeah almost as much as chrome

  10. @async_andrew 2y

    Source?

  11. @Box_of_the_Fox 2y

    Sounds like clean code

  12. @NickNirus 2y

    where is this from? really wanna know the context

    1. @Supuhstar 2y

      Same!

  13. @Knnknk72 2y

    print("Hello world")

Use J and K for navigation