Skip to content

perf: make guarded proposed changes atomic and fast#224

Merged
developer-1px merged 2 commits into
mainfrom
perf/history-overlap-cow
Jul 10, 2026
Merged

perf: make guarded proposed changes atomic and fast#224
developer-1px merged 2 commits into
mainfrom
perf/history-overlap-cow

Conversation

@developer-1px

Copy link
Copy Markdown
Owner

Summary

  • reuse one private copy-on-write sequential-replace seam for overlapping patch application and history inverse capture
  • keep leading RFC 6902 guard tests on the same fast path as their mutation suffix
  • accept proposed changes as one atomic guard-test + proposed-operation patch without changing the public API
  • reserve an accepting proposal through document publication so subscriber reentrancy cannot remove, reject, or replace it
  • preserve stable error classification, history/undo/redo semantics, and merged generated-id behavior during reentrant loads

Performance

50k-item document, 1,000 overlapping replace operations:

  • inverse: 41.79ms → 0.71ms (~59x)
  • history=100 patch: 43.18ms → 1.21ms (~36x)
  • guarded history=0 patch: 46.32ms → 0.70ms (~66x)
  • guarded history=100 patch: 92.14ms → 1.41ms (~65x)

Validation

  • npm run verify -w @interactive-os/json-document (457 passed, 4 skipped)
  • npm run verify -w @interactive-os/json-document-proposed-changes (21 passed)
  • npm run extensions:verify
  • npm run standard:check
  • npm run docs:check
  • git diff --check

@developer-1px
developer-1px merged commit 6fef8a4 into main Jul 10, 2026
3 checks passed
@developer-1px
developer-1px deleted the perf/history-overlap-cow branch July 10, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant