Skip to content

Reduce resolver allocation and bound candidate loops - #205

Merged
jdalton merged 2 commits into
dperini:masterfrom
jdalton:perf/resolver-execution
Sep 7, 2026
Merged

Reduce resolver allocation and bound candidate loops#205
jdalton merged 2 commits into
dperini:masterfrom
jdalton:perf/resolver-execution

Conversation

@jdalton

@jdalton jdalton commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Tooling update

Rebased onto merged #212 as one commit. Sources and tests use .mts, Node tests use Vitest, and the published JavaScript paths stay unchanged. The original engine changes are preserved.

Local lint, formatting, Node and packed-package checks pass. All 41 WPT pages pass against both generated builds.

Change

Extract the remaining resolver-execution work from #167: bounded candidate loops, direct cached-plan fetches, null no-op resolvers, raw match-resolver arrays, captured slicing, and early tag rejection within a compound selector.

This applies to master independently. It does not include #188's context-free plan caching, the attribute-equality optimization, or legacy-DOM handling. Those changes have separate destinations and must be reconciled when combined.

The extraction corrects two archived item-loop defects: the result index was uninitialized, and the tail replaced the result array with true. Compiled-cache keys now distinguish mode and callback presence, preventing a cached array loop or no-op from being reused for a different contract. Installed wrappers are tested with the captured slicing helper.

Validation: all 7 focused Node tests and 4 shared-runtime tests pass with Node 26.5.0 and jsdom 30.0.1. Coverage includes cold/cached queries, mutation, callbacks, escaped classes, cache turnover, both collection modes, tag-read ordering, and installation. Commands and scope are in docs/resolver-execution.md.

No new performance claim is made; representative benchmarks should be rerun on the combined branch.

@jdalton
jdalton force-pushed the perf/resolver-execution branch 2 times, most recently from faeaa66 to 90dfd95 Compare September 6, 2026 02:30
@jdalton
jdalton force-pushed the perf/resolver-execution branch from 90dfd95 to 2a1597b Compare September 6, 2026 11:40
@jdalton

jdalton commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

Integrated the merged legacy DOM and nth-index fixes. Added Node and WPT tests for bounded array/item loops and for adding, replacing, and omitting callbacks after matching is cached. Matching-cache keys now distinguish callback presence. All 465 Node tests and 49 WPT pages pass; CI is green, and coverage thresholds are unchanged.

@jdalton
jdalton merged commit 023aa94 into dperini:master Sep 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant