"Outperforming Imperative with Pure Functional Languages" by Richard Feldman
Strange Loop Conference6 HN recommenders · recommended in 6 months, 2021–2025
talk · intermediate · evergreen · 2021–2025 on HN
Richard Feldman explains how pure functional languages can match or beat imperative ones on performance. Compilers can turn immutable code into in-place mutation, avoiding naive copying. The talk draws on his work on the Roc language.
Recommended as the clearest explanation of why immutable data need not be slow, and as the introduction to Roc.
Up next
2 mo on HNArea 5150 by CRTC & Hornet (Party Version) / IBM PC+CGA Demo, Hardware Capture
x86VileR
2 HN recommender · 2022–2024
18 mo on HNRuby Conf 12 - Y Not- Adventures in Functional Programming by Jim Weirich
Confreaks
17 HN recommender · 2013–2026
14 mo on HNThe Soul of Erlang and Elixir • Sasa Juric • GOTO 2019
GOTO Conferences
16 HN recommender · 2019–2024
14 mo on HN"Simple Made Easy" - Rich Hickey (2011)
Strange Loop Conference
14 HN recommender · 2022–2026
13 mo on HN"Making Impossible States Impossible" by Richard Feldman
elm-conf
9 HN recommender · 2017–2026
12 mo on HNWilliam Byrd on "The Most Beautiful Program Ever Written" [PWL NYC]
PapersWeLove
11 HN recommender · 2017–2026
11 mo on HNThe Value of Values with Rich Hickey
InfoQ
10 HN recommender · 2014–2023
12 mo on HNWhy Isn't Functional Programming the Norm? – Richard Feldman
Metosin
12 HN recommender · 2019–2025
11 mo on HNMaybe Not - Rich Hickey
ClojureTV
14 HN recommender · 2018–2025
11 mo on HNSolving Problems the Clojure Way - Rafal Dittwald
Clojure/north
10 HN recommender · 2019–2025
10 mo on HNLecture 1A: Overview and Introduction to Lisp
MIT OpenCourseWare
10 HN recommender · 2019–2026
10 mo on HNConway's Game Of Life in APL
Dyalog
11 HN recommender · 2010–2024
8 comments from Hacker News
We already have many great GC'd functional languages at that performance level. I first learned about Roc from this talk: ▶ this video That's a niche that is not currently filled (well, maybe MLTon) and that has me very excited! I'm sure I'm not alone here.
1. Structural sharing - most data doesn't change so you create a copy that reuses much of the original structure 2. Garbage collection and lexical scopes - you clean up memory quickly and in batch 3. Compiler optimizations - you turn functional constructs into imperative ones that reuse and mutate memory at compile-time, where it is provably safe to do so Roc Lang might interest you: ▶ this video
If you are interested, «why yet another programming language?». The unique selling point of Roc is clever optimization to convert purely functional source code to deep-imperative fast machine code, while keeping all the correctness of functional algorithms. See this video of Richard Feldman for details — «Outperforming Imperative with Pure Functional Languages»: ▶ this video Among those clever optimizations: - static reference counting (no GC, like in Rust, but with no borrowing and borrow problems); - stack allocation of the data with no external links; - hidden («opportunistic») mutability even in the cases, where Haskell or Lisp will copy the value.
> Functional programming experts say that their code is efficient because the compiler translates it to an efficient representation on the CPU. They have TCO and other things. But they don't mutate data and hence every function call creates a new data in memory taking up space. How do they overcome that? By letting the compiler make assumptions. For example, consecutive map calls can be converted into a single one. If the data isn't shared with something else, the compiler can mutate it. MUCH easier to paralellize maps. As a starting point for those nitty grittys, this talk is probably as good as any ▶ this video
Maybe link ? It's not production ready, I just saw nice talk by Richard Feldman [1] about it and it's inspired by Elm. [1] ▶ this video
> How would one optimize for immutability in this case, other than turning it back into mutability behind the scenes? Roc-lang, which is a functional, systems language in development uses something called opportunistic in-place mutation to do just that. Here's a video where the creator talks about it: ▶ this video
This talk by Richard Feldman about Roc (a new language) goed into why immutable does not necessarily mean slow and given enough attention can mean higher performance in certain cases: ▶ this video
So many new programming languages coming up with clever features that makes me wish I could mix and match their core features while using libraries from more popular languages. Up and coming Languages I am excited about - 1. Roc - ▶ this video 2. Zig - link 3. Scopes - link 4. Gleam - link 5. Odin - link 6. Koka - link 7. Unison - link