Skip to content

perf: replay unchanged element subtrees - #143

Open
cowboyd wants to merge 1 commit into
mainfrom
perf/element-replay
Open

cowboyd wants to merge 1 commit into
mainfrom
perf/element-replay

Conversation

@cowboyd

@cowboyd cowboyd commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

When one part of the DOM changes, UI currently serializes the entire tree again. Track changed nodes and their ancestors for each frame, then use TTY 0.11.0's native replay directives for unchanged subtrees. Changed branches are rebuilt, and each frame retains the render information needed by the next frame.

Attribute mutations invalidate their owner element, including direct Attr.value updates. Insertions and moves invalidate the affected parent chains. Replay also checks resolved inherited colors so ancestor style changes cannot reuse stale text or border colors.

Type of change

  • Bug fix
  • Feature
  • Refactor (no behavior change)
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • All tests pass (pnpm test)
  • Files are formatted (pnpm format)
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset

AI-generated code disclosure

  • This PR includes AI-generated code

@socket-security

socket-security Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​bomb.sh/​tty@​0.10.0 ⏵ 0.11.08410099 +194 +1100

View full report

@pkg-pr-new

pkg-pr-new Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

commit: 2b53d36

@cowboyd
cowboyd marked this pull request as ready for review December 1, 2026 23:23
@cowboyd
cowboyd marked this pull request as draft December 1, 2026 23:24
@cowboyd
cowboyd marked this pull request as ready for review December 1, 2026 23:25
@codspeed

codspeed Bot commented Dec 2, 2026

Copy link
Copy Markdown

Merging this PR will regress 2 benchmarks

⚡ 132 improved benchmarks
❌ 2 regressed benchmarks
✅ 106 untouched benchmarks
⏩ 60 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Memory grass (100) 34.8 KB 672.4 KB -94.82%
❌ Memory grass (500) 143.9 KB 497.9 KB -71.09%
⚡ Memory bamboo (1500) 421.3 KB 5.6 KB ×75
⚡ Memory maple (1500) 422.5 KB 6.3 KB ×67
⚡ Memory evergreen (1500) 421.3 KB 6.4 KB ×66
⚡ Memory bush (1500) 422 KB 6.8 KB ×62
⚡ Memory bush (1500) 422.6 KB 6.9 KB ×61
⚡ Memory evergreen (1500) 419.6 KB 7 KB ×60
⚡ Memory maple (1500) 420.7 KB 7.3 KB ×58
⚡ Memory sequoia (1500) 420.7 KB 7.7 KB ×54
⚡ Memory bamboo (1500) 420.2 KB 8.3 KB ×51
⚡ Memory sequoia (1500) 422.5 KB 9.4 KB ×45
⚡ Memory bamboo (1000) 282 KB 6.6 KB ×43
⚡ Memory maple (1000) 283.3 KB 6.7 KB ×43
⚡ Memory bush (1000) 282.5 KB 6.8 KB ×42
⚡ Memory sequoia (1000) 283.3 KB 6.9 KB ×41
⚡ Memory bush (1000) 283.9 KB 7.9 KB ×36
⚡ Memory bamboo (1000) 283.1 KB 7.9 KB ×36
⚡ Memory sequoia (1000) 282.1 KB 8 KB ×35
⚡ Memory evergreen (1000) 283.9 KB 8.4 KB ×34
... ... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing perf/element-replay (2b53d36) with main (2c98efd)

Open in CodSpeed

Footnotes

  1. 60 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

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