"Outperforming Imperative with Pure Functional Languages" by Richard Feldman

Channel:Strange Loop Conference · Length:34:55 · Published:2021-10-20 · Views:98381

Watch on YouTube

Summary

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.

Why HN recommends it

Recommended as the clearest explanation of why immutable data need not be slow, and as the introduction to Roc.

As a starting point for those nitty grittys, this talk is probably as good as any — HN, 2022

Functional programming · Software performance & optimization · Compilers, interpreters & program analysis

Subtitles (excerpt)

this is outperforming imperative with pure functional languages i'm richard feldman so for the past couple years i've been working on building a programming language called rock and rock is inspired by and a direct descendant of my what has been my favorite programming language for several years now which is l um elm is one of the things that i love about it is it's got this really delightful user experience it really gives me joy to program in it it's a pure functional language and it's compiled to javascript so it's really good for making browser-based uis but i've wanted sort of like an like experience in other domains besides browser-based uis and so rock has similar goals to album of having like a delightful user experience and it's a pure functional programming language like elm but it's compiled to binary so it's sort of for other use cases that elm is not meant for at the moment um so i first got into elm based on this blog post blazing fast html and elm which came out in 2014 and one of the things that i appreciated about elm was i had a relatively performance sensitive ui that i was building and i really like to see this benchmark that sort of gave me confidence that i was gonna have a fast experience when i was

On Hacker News

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. — greener_grass, 2025-02
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] — greener_grass, 2024-10
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 optimiz… — yashrk, 2023-11
> 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… — Akronymus, 2022-06
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] — aquadrop, 2022-02

Related videos