WINTER SALE IS ON!
Flyweight

Flyweight in Rust

Flyweight is a structural design pattern that allows programs to support vast quantities of objects by keeping their memory consumption low.

The pattern achieves it by sharing parts of object state between multiple objects. In other words, the Flyweight saves RAM by caching the same data used by different objects.

Rendering a Forest

Flyweight in Other Languages

Flyweight in C# Flyweight in C++ Flyweight in Go Flyweight in Java Flyweight in PHP Flyweight in Python Flyweight in Ruby Flyweight in Swift Flyweight in TypeScript