fireproof-storage / fireproof-storage/fireproof
[Performance] Implement IndexedDB transaction batching
- Dominant language
- TypeScript
- Stars
- 973
- Forks
- 58
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
Each write operation currently creates a separate IndexedDB transaction. Batching multiple writes into single transactions would significantly improve throughput.
## Problem
In `core/gateways/indexeddb/gateway-impl.ts`, each `put()` call creates its own transaction. IndexedDB transactions have overhead, and frequent small transactions are inefficient for bulk writes.
## Proposed Solution
1. Add batch queue configuration to database options
2. Create `BatchQueue` at `core/gateways/indexeddb/batch-queue.ts`
3. Implement time-window batching:
- Collect writes within configurable window (e.g., 10ms)
- Execute as single transaction
4. Implement read-your-writes consistency check
5. Add batch statistics reporting
6. Create throughput benchmarks
## Expected Outcomes
- Multiple writes within time window share one transaction
- Batched writes maintain atomicity
- Read-your-writes consistency maintained
- 5x throughput improvement on bulk writes (benchmark verified)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.