Long-lived agent
Load the single JSON once, about 3.4 seconds. Lookups, decks, and scans then stay in memory. A write rewrites all 161 MB, so it is the weak spot.
Agent storage
Two ways to keep a 36,709-card corpus for an agent: one JSON file, or one file per card. Same bytes on disk. Very different times once the agent starts reading, scanning, or writing.
On this mix
Set a count
Add a cold start or an operation. Both sides stay at zero until you do.
empty mix
Scaled to the slower side of this mix. Single JSON lookups are already in memory. Per-file cold start only lists files.
Nothing to time yet. Pick a preset, or type a count above.
Means from the bench. Full scans ran twice. Cold start ran five times. Rewriting the single file ran three times. Everything else ran ten.
36,709 cards. Single JSON is 161.03 MB. Per-file is 161.12 MB.
Load the single JSON once, about 3.4 seconds. Lookups, decks, and scans then stay in memory. A write rewrites all 161 MB, so it is the weak spot.
One file per card. No multi-second parse, a lookup is about 0.3 ms, and a write is under a millisecond. A full scan walks every file and takes around 13 seconds.
Keep the per-file cards and add a small name-to-id index. Load the index at startup, read cards on demand, and scan only when you mean to scan.