Agent storage

Card Storage Bench

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

No workload yet

Set a count

Add a cold start or an operation. Both sides stay at zero until you do.

Single JSON
0 ms
Per-file
0 ms

empty mix

Workload

One long-lived process. Lots of reads, a few scans, one write.

Where the time goes

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.

The measured runs

Means from the bench. Full scans ran twice. Cold start ran five times. Rewriting the single file ran three times. Everything else ran ten.

Disk

36,709 cards. Single JSON is 161.03 MB. Per-file is 161.12 MB.

What the bench suggests

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.

Short-lived agent

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.

Hybrid

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.