pattern-flyweight
CommunityShare state to shrink memory use.
Software Engineering#typescript#memory-optimization#design-pattern#factory-pattern#shared-state#flyweight#structural-pattern
Authorjohnnystefan
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Large numbers of similar objects each holding entire state waste memory and slow down rendering, caching, or simulation workloads at scale, making the system inefficient.
Core Features & Use Cases
- State separation: categorize fields into intrinsic (shared, immutable) and extrinsic (contextual) so clients can supply what changes per instance.
- Centralized flyweight management: reuse a pool of shared objects via a factory that hands out existing instances instead of duplicating data.
- Use Case: When drawing thousands of trees or caching configuration for large numbers of availability slots, store only one copy of the shared attributes and reuse it across all records while clients manage their unique coordinates or schedules.
Quick Start
Ask the flyweight skill to reuse shared intrinsic state whenever you render large object collections to minimize memory.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: pattern-flyweight Download link: https://github.com/johnnystefan/test-saas-business/archive/main.zip#pattern-flyweight Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.