Description
useAppState.tsx:265-275 allocates a new BoundedMap on every miss by making a full copy of existing entries, which is inefficient and triggers unnecessary garbage collection.
Environment
- OS: Any
- Node version: Node 22+
- Nanocoder version: 1.29.0
- Provider: Any
- Model: Any
Steps to Reproduce
- Run Nanocoder in interactive mode.
- Perform operations that frequently miss the BoundedMap cache.
- Profile memory allocations.
Expected Behavior
The map should update in-place, perhaps by tracking the oldest entry via an insertion counter.
Actual Behavior
A new BoundedMap is allocated on every miss.
Logs/Screenshots
N/A
Additional Context
Description
useAppState.tsx:265-275allocates a newBoundedMapon every miss by making a full copy of existing entries, which is inefficient and triggers unnecessary garbage collection.Environment
Steps to Reproduce
Expected Behavior
The map should update in-place, perhaps by tracking the oldest entry via an insertion counter.
Actual Behavior
A new
BoundedMapis allocated on every miss.Logs/Screenshots
N/A
Additional Context