Background
Currently Store.rebuildMerkleRoot() (store.go:154) loads and rebuilds the entire Merkle tree on every append operation. This is O(n) complexity per write.
Problem
For runs with 10k+ log entries, this becomes a performance bottleneck. Each append requires loading all entries and recomputing the full tree.
Proposed Solution
Implement incremental Merkle tree updates:
- Track the tree structure in memory
- Only recompute affected branches when appending
- This reduces append cost from O(n) to O(log n)
Acceptance Criteria
Priority
Low - Current implementation is acceptable for Phase 1. Only optimize if performance issues are observed with high-volume logging.
References
Background
Currently
Store.rebuildMerkleRoot()(store.go:154) loads and rebuilds the entire Merkle tree on every append operation. This is O(n) complexity per write.Problem
For runs with 10k+ log entries, this becomes a performance bottleneck. Each append requires loading all entries and recomputing the full tree.
Proposed Solution
Implement incremental Merkle tree updates:
Acceptance Criteria
Priority
Low - Current implementation is acceptable for Phase 1. Only optimize if performance issues are observed with high-volume logging.
References