Skip to content

Cache hover selector triggers - #121

Merged
wieslawsoltes merged 1 commit into
mainfrom
perf/cache-hover-selector-triggers
Sep 16, 2026
Merged

wieslawsoltes merged 1 commit into
mainfrom
perf/cache-hover-selector-triggers

Conversation

@wieslawsoltes

@wieslawsoltes wieslawsoltes commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Hover invalidation recompiled every dependency trigger for every changed hover-path node. The work scaled as path depth × dependency count × selector parse cost, so a 4,000-selector workload delayed publication of accepted input.

Change

  • compile each hover trigger once while indexing selector dependencies;
  • retain its source string for diagnostics and reuse the compiled selector during hover transitions;
  • add a focused hover-dependency-cache native runner covering functional/sibling selector behavior and the deep descendant case;
  • measure the 4,000-dependency/32-depth transition through the scene carrying the pointer sequence, so the 30 ms gate includes cascade, required layout/tree work, and publication;
  • require stable DOM-node count and no more than one layout pass for the transition.

Validation

Focused current head d04ca758702ced1b0e56b8368ff55c9fe0d06da6:

  • git diff --check HEAD^ HEAD — pass;
  • Release-equivalent -fsyntax-only compile of webscene_v8_runtime.cpp with V8/html5ever/cssparser/Servo/generated-bindings production flags — pass;
  • Release-equivalent -fsyntax-only compile of native_v8_runtime_tests.cpp — pass;
  • historical uncached control: 72.599 ms;
  • original cached candidate: 5.025 ms (14.4× faster).

The current-head runner must pass WEBSCENE_NATIVE_ENGINE_TEST_FILTER=hover-dependency-cache; that result is the authoritative changed-behavior gate. Broad package and product matrices are outside this focused parser/cache change.

Integration

Closes #115.

The equivalent implementation also exists in draft consolidation PR #76. This focused PR targets main directly; #76 remains open and unmerged.

@wieslawsoltes
wieslawsoltes force-pushed the perf/cache-hover-selector-triggers branch 2 times, most recently from e3fe37c to 103366c Compare September 16, 2026 10:04
@wieslawsoltes
wieslawsoltes changed the base branch from review/code-oss-hover-cache-base to main September 16, 2026 10:20
@wieslawsoltes
wieslawsoltes force-pushed the perf/cache-hover-selector-triggers branch from 103366c to d04ca75 Compare September 16, 2026 21:58
@wieslawsoltes
wieslawsoltes marked this pull request as ready for review September 16, 2026 21:59
@wieslawsoltes
wieslawsoltes merged commit 4235f2f into main Sep 16, 2026
2 of 17 checks passed
@wieslawsoltes
wieslawsoltes deleted the perf/cache-hover-selector-triggers branch September 16, 2026 22:01
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.

Cache hover selector triggers to prevent input publication stalls

1 participant