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"
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"
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.
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)
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.