Skip to content

Performance: successful commit path re-deserializes the just-inserted BSON document #77

@AGiorgetti

Description

@AGiorgetti

Summary

After a successful insert, Commit() returns commitDoc.ToCommit(_serializer). This means the write path serializes the commit to BSON for insert, then immediately deserializes the same BSON back to ICommit to return it — pure redundant work.

Why this matters

  • Post-insert CPU and allocation overhead on every successful commit.
  • The cost is independent of MongoDB round-trip latency.
  • Likely noise relative to total write-path time, but worth quantifying before dismissing.

Proposed investigation

  • Measure the post-insert deserialization cost as a fraction of total write-path time using MemoryDiagnoser.
  • Evaluate building the return ICommit from the original in-memory object instead of round-tripping through BSON.
  • Only act if the cost is measurable (> ~1% of total write time).

Reference

See docs/Performance-Investigation.md → Finding #5 for full context.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions