Skip to content

feat(core): translation-only invalidation for x/y updates - #987

Merged
wouterlucas merged 1 commit into
lightning-js:mainfrom
wouterlucas:feat/phase2-translate-only-invalidation
Nov 26, 2026
Merged

wouterlucas merged 1 commit into
lightning-js:mainfrom
wouterlucas:feat/phase2-translate-only-invalidation

Conversation

@wouterlucas

Copy link
Copy Markdown
Contributor

Phase 2 of fast paths: behavior-preserving update-cycle shortcut for pure translation.

  • New UpdateType.Translate (narrower than Local; All widened to 32767, added to RTT_NOTIFY_MASK). The x/y setters request it; a general Local flag set in the same frame still dominates in update().
  • New updateLocalTranslation(): when rotation/scale/contain-resize are inert the local transform is always a pure translation, so only the translation terms are rewritten, including the stable mount offset (localOrigin = position - mount * dimensions). Nonzero mounts are now eligible for the translation fast path.
  • The global-update fast path keys on _localIsTranslate (mount-aware) instead of isSimple, so both parent global and local collapse to two additions for translation-only nodes under translation-only parents.
  • Child traversal, visibility, clipping, render-list and RTT notifications are untouched; mixed updates fall back to the general path.

Phase 2 of the L2-style fast paths: behavior-preserving update-cycle
shortcut for pure translation.

- New UpdateType.Translate (narrower than Local; All widened to 32767,
  added to RTT_NOTIFY_MASK). The x/y setters request it; a general Local
  flag set in the same frame still dominates in update().
- New updateLocalTranslation(): when rotation/scale/contain-resize are
  inert the local transform is always a pure translation, so only the
  translation terms are rewritten, including the stable mount offset
  (localOrigin = position - mount * dimensions). Nonzero mounts are now
  eligible for the translation fast path.
- The global-update fast path keys on _localIsTranslate (mount-aware)
  instead of isSimple, so both parent global and local collapse to two
  additions for translation-only nodes under translation-only parents.
- Child traversal, visibility, clipping, render-list and RTT
  notifications are untouched; mixed updates fall back to the general
  path.

Tests: CoreNode.translate.test.ts (9). Full suite 558 passed, build
clean, eslint 0 errors (warnings pre-existing / test-style only).
@wouterlucas

Copy link
Copy Markdown
Contributor Author

FWIW:

Average FPS by framework and rectangle count:
┌────────────────┬──────────────┬──────────────┬─────────────┐
│ (index)        │ 4000         │ 8000         │ 16000       │
├────────────────┼──────────────┼──────────────┼─────────────┤
│ blits          │ '40.87 FPS'  │ '15.62 FPS'  │ '8.45 FPS'  │
│ ftl            │ '96.23 FPS'  │ '31.05 FPS'  │ '13.17 FPS' │
│ lightning2     │ '94.80 FPS'  │ '48.21 FPS'  │ '23.37 FPS' │
│ renderer       │ '42.73 FPS'  │ '21.42 FPS'  │ '11.72 FPS' │
│ renderer-local │ '120.09 FPS' │ '101.09 FPS' │ '43.17 FPS' │
└────────────────┴──────────────┴──────────────┴─────────────┘

where renderer-local is this PR and #986 running a canvas slaylines type test
and renderer is the current latest published main version

adding that to the default benchmarks we do on every release

@wouterlucas
wouterlucas merged commit 17d97cb into lightning-js:main Nov 26, 2026
4 checks passed
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