Patrick Dubroy
@dubroy
Anyone have a good example of a programming language construct that *only* exists for perf reasons?

i.e. where you can achieve the same thing with a more general construct, but there is a more specific thing that's "equivalent to X, but much faster"
Aug 7, 2022 · 3 · 1

Context: I'm looking at low-hanging perf improvements in @_ohmjs. I could do them as optimizations you get "for free", but that can lead to opaque (and brittle) heuristics and non-obvious perf footguns.

Or, I could add more specialized constructs that are always optimizable.

Thanks for the answers so far! I should add that I'm most interested in

1️⃣ examples from higher-level languages
2️⃣ cases that involve only a "syntactically-local" change (e.g., adding an annotation)

https://twitter.com/dubroy/status/1556203177803931648 ∙ Archived on 2025-03-28.

← Twitter Archive: 2022