The Essence of the Flyweight Design Pattern
summary
Claims that the Flyweight pattern becomes a language feature by adding safe memoization of constructors, implements it in the Hush language (runtime in Rust), and uses shared-ownership pointers so mutated memoized objects are evicted from the cache. Prototype adds one extra level of indirection for memoized attribute access, leaves non-memoized objects unchanged, and includes an Alloy formalization. Benchmarks show huge wins for referentially‑transparent functions and minimal overhead versus unsafe memoization on object‑oriented workloads; code and experiments are published.
AI-written summary · about
chapters (9)
- 0:00Flyweight pattern intro
- 2:31Why Flyweight matters
- 7:48Hush programming language
- 8:33What is Flyweight
- 9:55Flyweight in Hush
- 12:49Safe memorization with shared pointers
- 14:17Memorization performance benchmarks
- 20:33When memorization helps
- 21:57Conclusion
related talks
01h 35mRuntime Polymorphism: Back to the Basics
01h 23mRethink Polymorphism in C++
01h 08mRuntime Polymorphism: Back to the Basics
25mResponsive Parallelism with Synchronization
51mDesigning for Performance
55mBreaking Dependencies: Type Erasure - The Implementation Details
01h 08mFireside chat
01h 31mWhen Abstractions Fix Too Much - Towards Flexible Library Design
