Skip to content

Perf: avoid parent-wide scans for command insertion - #208

Merged
raquo merged 1 commit into
raquo:masterfrom
nguyenyou:codex/command-insert-span-walk
Sep 19, 2026
Merged

raquo merged 1 commit into
raquo:masterfrom
nguyenyou:codex/command-insert-span-walk

Conversation

@nguyenyou

Copy link
Copy Markdown
Contributor

CollectionCommand.Insert currently searches the parent’s children to locate both span boundaries. Walk directly from the start or end sentinel instead, limiting traversal to O(min(abs(index), span size)), independent of unrelated siblings.

Preserve negative indexing and boundary clamping. Count toward zero to handle Int.MinValue without overflow, and report the out-of-range distance and clamped boundary.

Add regression tests for Int.MinValue on populated and empty spans.

Validation: all 10 ChildrenCommandReceiverSpec tests pass under Node.js; git diff --check passes.

Walk within the command span and count toward zero to handle Int.MinValue safely. Add populated and empty span regression tests.

Co-Authored-By: Codex GPT-6 Astra <codex@openai.com>
@nguyenyou
nguyenyou requested a review from raquo as a code owner September 19, 2026 09:36
@raquo

raquo commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Thanks, good efficiency 👍

@raquo
raquo merged commit bad7073 into raquo:master Sep 19, 2026
@nguyenyou
nguyenyou deleted the codex/command-insert-span-walk branch September 19, 2026 10:01
@nguyenyou nguyenyou changed the title fix(laminar): avoid parent-wide scans for command insertion Perf: avoid parent-wide scans for command insertion Sep 20, 2026
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.

2 participants