"Outperforming Imperative with Pure Functional Languages" by Richard Feldman
Strange Loop Conference6 HN recommenders · 2021–2025
98K views · talk · evergreen · Uploaded 2021-10-20
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.
53:22Ruby Conf 12 - Y Not- Adventures in Functional Programming by Jim Weirich
Confreaks
49:55How Python was Shaped by leaky Internals, Armin Ronacher, Flask framework
Видео с мероприятий {speach!
42:03The Soul of Erlang and Elixir • Sasa Juric • GOTO 2019
GOTO Conferences
1:01:39"Simple Made Easy" - Rich Hickey (2011)
Strange Loop Conference
36:45Rich Harris - Rethinking reactivity
You Gotta Love Frontend
25:06"Making Impossible States Impossible" by Richard Feldman
elm-conf
1:12:27CppCon 2015: Andrei Alexandrescu “std::allocator...”
CppCon
51:18Lexical Scanning in Go - Rob Pike
GoogleFOSSSydney
8 comments from Hacker News
> 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: [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: [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 - [VIDEO] 2. Zig - [LINK] 3. Scopes - [LINK] 4. Gleam - [LINK] 5. Odin - [LINK] 6. Koka - [LINK] 7. Unison - [LINK]
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] [VIDEO]
> 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 [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»: [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.
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: [VIDEO]
We already have many great GC'd functional languages at that performance level. I first learned about Roc from this talk: [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.