CppCon 2017: Juan Pedro Bolivar Puente “Postmodern immutable data structures”
CppCon5 HN recommenders · recommended in 7 months, 2017–2025
talk · advanced · evergreen · 2017–2025 on HN
Juan Pedro Bolivar Puente explains immutable and persistent data structures in C++ and how they support value semantics. He presents the Immer library, rrb-trees, and a prototype text editor that opens a huge file instantly.
HN people point to it for rrb-trees, text editor data structures and bringing Clojure-style persistent structures to C++.
Up next
5 mo on HNSimon Peyton-Jones: Escape from the ivory tower: the Haskell journey
Churchill College, University of Cambridge
5 HN recommender · 2017–2024
8 mo on HNSteve Jobs' 2005 Stanford Commencement Address
Stanford
9 HN recommender · 2009–2023
3 mo on HNThe Art of the Bodge: How I Made The Emoji Keyboard
Tom Scott
4 HN recommender · 2018–2024
11 mo on HNJan Willem Nijman - Vlambeer - "The art of screenshake" at INDIGO Classes 2013
Dutch Game Garden
10 HN recommender · 2014–2025
4 mo on HNTomorrow Corporation Tech Demo
retrogameinternals
5 HN recommender · 2023–2026
3 mo on HNLearn to Paint with Mathematics
Inigo Quilez
3 HN recommender · 2022–2025
11 mo on HNCppCon 2015: Andrei Alexandrescu “std::allocator...”
CppCon
7 HN recommender · 2017–2025
12 mo on HNLexical Scanning in Go - Rob Pike
GoogleFOSSSydney
13 HN recommender · 2012–2025
10 mo on HNCppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step”
CppCon
9 HN recommender · 2018–2026
9 mo on HNRustConf 2018 - Closing Keynote - Using Rust For Game Development by Catherine West
Rust Programming Language
9 HN recommender · 2018–2023
10 mo on HNCppCon 2016: Jason Turner “Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17”
CppCon
13 HN recommender · 2016–2024
9 mo on HNIdeas about a new programming language for games.
Jonathan Blow
7 HN recommender · 2014–2025
12 comments from Hacker News
Hey. Check out Juan Pedro Bolivar Puente's talks om value oriented design. He worked on Ableton which is a large application. He specifically speaks to Undo. He describes a much better pattern than the Command Pattern. He also released his source for Value Oriented Data structures Juan Pedro is a next level programmer who I think has pushed the craft forward through his work on bringing Value Oriented Design into the C++ world. Talk I ▶ this video Talk II link Data Structures: link Application Structure: link Text Editor: link Good luck.
> [...] which is a must for anything performance oriented. But that's also not really true. Using functional data structures it is possible to write highly performant software. Check out for example "CppCon 2017: Juan Pedro Bolivar Puente - Postmodern immutable data structures"[1], an impressive talk, in which someone shows their developed editor that can edit huge text files without lag faster than any mainstream editor today. This is enabled by functional data structures. Usage of functional data structures throughout a project also ensures, that parts can be trivially parallelized, which is not true for traditional algorithms, and therefore can easily scale with number of CPUs available. For more on that subject, you might want to watch a few Joe Armstrong talks. Rust achieves type safety by introducing more language concepts like ownership, borrowing, and lifetimes, to formalize, who has access when and how. It also creates things as immutable by default, unless you make use of `mut`. Unfortunately, Rust's philosophy is shared memory and making shared memory access safe, rather than message passing, which is at odds with FP. [1]: ▶ this video
You might be interested in ewig and immer by Juan Pedro Bolivar Puente: link link See the author instantly opening a ~1GB text file with async loading, paging through, copying/pasting, and undoing/redoing in their prototype “ewig” text editor about 27 minutes into their talk here: ▶ this video It’s backed by a “vector of vectors” data structure called a relaxed radix balanced tree: link That original paper has seen lots of attention and attempts at performance improvements, such as: link link
Immer [0][1] seems like a really serious attempt at bringing high-quality persistent data structures to C++. [0]: ▶ this video [1]: link
Mmm tasty. If anyone wants a backstory building up to this data structure checkout this talk: ▶ this video He builds an rrb-tree which uses the same underlying concepts ALEX uses, just without the ML-enhancement.
Not a benchmark but rrb-trees are pretty neat. They give an effective O(1) for all operations. Modern languages like Scala's Vector type is an rrb-tree under the hood: link For more fun: ▶ this video
In case anyone hasn't seen it this CppCon talk ▶ this video talks about rrb-trees and how they're a great data structure for writing a text editor that can handle unlimited sized documents without locking up, and allows for editing while saving and opening, and an easy way to support an undo command. Most text editors today do not support such functionality. With lockless data structures like an rrb-tree it becomes easy. It really is an ideal way to do write a text editor.
Not to disagree, but to be fair modern fp runtimes use data structures that wouldn't have to copy so many bytes as the whole state. A nice showcase of this idea is in Juan Pedro Bolivar Puente's CppCon '17 talk Postmodern Immutable Data Structures: ▶ this video
For another approach: I built a didactic text editor to teach "value oriented design" and immutable data-structures in C++: link It's design is covered in these talks: - Postmodern immutable data structures: ▶ this video - The most valuable values: link
Interesting. I wonder how similar a Judy array is to an rrb-tree (relaxed radix binary tree), or if they're the same thing. An rrb-tree is an effective O(1) time for every category. Scala's Vector type implements one. If interested about the data structure: ▶ this video Scala bigO doc: link Scala's doc on it: link
One example is streaming. Streams allow for a near infinite array size to be processed, because it works on one element at a time as it comes in. Streams come from the FP world. From that function chaining originates from the FP world and is used in modern languages like Python quite heavily. You mentioned research, so a valid example of this is the difference between Spark and MapReduce. Spark was introduced to optimize processing large sets of data, by streaming it. MapReduce does not. For a more heavy example, a few data structures that are quite powerful come from the FP world. For example, this cppcon talk is introduces one, which gives near O(1) time for all uses (insert, delete, lookup, ...), and can be used in a thread safe way: ▶ this video
Interesting to hear about C++ in this context, since of my goals is to make C++ more like Clojure: ▶ this video link There is a lot of I could say about the relationship between C++ and Clojure, but I'll leave it at that for now :-)