Summary
Every GetFrom* read path calls doc.ToCommit(_serializer), which fully deserializes the entire commit and all event payloads — even when the caller only needs iteration or metadata.
What ToCommit does on every document
- Deserializes the whole
MongoCommit object from BsonDocument.
- Iterates every stored event.
- Deserializes each
EventMessage payload.
- Materializes the event set into an array.
Why this matters
- Global checkpoint scans pay full payload materialization cost even when the caller only needs a cursor over commits.
- This cost grows with event count and payload size.
- Allocation pressure will likely dominate long sequential reads (especially for large event counts per commit).
- This is the primary bottleneck for read-heavy workloads.
Baseline (net10, 2026-05-20)
| Benchmark |
Mean |
ReadFromEventStoreAsync(CommitsToWrite=10000) |
120.443 ms |
ReadFromStream(CommitsToWrite=10000) |
148.004 ms |
Proposed investigation
Reference
See docs/Performance-Investigation.md → Finding #2 for full context.
Summary
Every
GetFrom*read path callsdoc.ToCommit(_serializer), which fully deserializes the entire commit and all event payloads — even when the caller only needs iteration or metadata.What
ToCommitdoes on every documentMongoCommitobject fromBsonDocument.EventMessagepayload.Why this matters
Baseline (net10, 2026-05-20)
ReadFromEventStoreAsync(CommitsToWrite=10000)ReadFromStream(CommitsToWrite=10000)Proposed investigation
MemoryDiagnoser.Reference
See
docs/Performance-Investigation.md→ Finding #2 for full context.