Skip to content

Improve decoration cell lookup performance#5886

Open
tt-a1i wants to merge 1 commit into
xtermjs:masterfrom
tt-a1i:codex/perf-decoration-cell-lookup
Open

Improve decoration cell lookup performance#5886
tt-a1i wants to merge 1 commit into
xtermjs:masterfrom
tt-a1i:codex/perf-decoration-cell-lookup

Conversation

@tt-a1i
Copy link
Copy Markdown

@tt-a1i tt-a1i commented May 20, 2026

Summary

Refs #5176.

This speeds up decoration lookup for the common single-line decoration case. When no registered decoration spans multiple rows, forEachDecorationAtCell now asks the sorted decoration list for the current line instead of scanning every decoration for every cell.

Multi-line decorations continue to use the existing full scan path so their behavior is unchanged.

Validation

  • npm run build && npm run esbuild
  • npm run test-unit -- out-esbuild/common/services/DecorationService.test.js out-esbuild/common/SortedList.test.js
  • npm run lint-changes

Notes

A local micro-benchmark with 10k single-line decorations over an 80x24 viewport for 20 iterations went from about 2479ms on the full-scan path to about 6.9ms with the line-keyed fast path.

@tt-a1i tt-a1i marked this pull request as ready for review May 20, 2026 13:54
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.

1 participant