Skip to content

fix(terminal): speed up dense keyword highlighting - #2581

Merged
binaricat merged 3 commits into
mainfrom
codex/issue-2251-xterm-decoration
Jul 29, 2026
Merged

binaricat merged 3 commits into
mainfrom
codex/issue-2251-xterm-decoration

Conversation

@binaricat

@binaricat binaricat commented Jul 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

Upgrade the terminal core to the first build containing xterm.js's decoration lookup optimization, addressing the dense keyword-highlighting repaint cost identified in the latest #2251 reproduction.

This PR intentionally targets the proven dense-decoration bottleneck. It does not claim that every Vim or command-history lag path in #2251 is resolved; affected Windows verification is still required.

Type of Change

  • Bug fix
  • New feature
  • Refactor / code cleanup
  • Documentation update
  • Build / CI change
  • Other (please describe):

Related Issue (optional)

Related to #2251

Changes Made

  • Upgrade @xterm/xterm from 6.1.0-beta.220 to 6.1.0-beta.221, which contains Optimize forEachDecorationAtCell by maintaining cache against buffer line index xtermjs/xterm.js#5902.
  • Keep @xterm/addon-webgl pinned at 0.20.0-beta.219, preserving Netcatty's existing atlas safety patch.
  • Exercise Netcatty's real KeywordHighlighter against representative log output, then run the 20,000-decoration upstream stress regression.
  • Measure through two browser paint frames and make failure cleanup reliable on Windows.
  • Run the live Electron regression in required Linux CI under Xvfb.

Screenshots / Demo

Same-machine comparison for the 20,000-decoration bottleneck:

  • Before: 267–269 ms to reach xterm's render completion.
  • After: 13–19 ms to reach xterm's render completion.
  • Final test also waits for two browser paint frames; current worst complete-paint result is about 50 ms.
  • Netcatty's real highlighter path retained 712 decorations and completed the same paint guard in about 46 ms.

Testing

  • I have tested these changes locally (npm run dev)
  • Linting passes (npm run lint)
  • Tests pass (npm test — 8,222 tests, 0 failures)
  • Generated capability tool specs are updated when applicable (not applicable; catalog unchanged)
  • No new console errors or warnings, if this affects app behavior

Additional checks:

  • npm run build
  • npm run test:xterm-decoration-performance
  • npm run test:xterm-webgl-overflow
  • Focused terminal and workflow suites
  • npx tsc --noEmit remains red on pre-existing repository-wide type errors; none point to the changed files.

Checklist

  • My code follows the existing project style
  • I have added or updated relevant regression coverage
  • I have not introduced any breaking changes

@binaricat binaricat added the automation:codex-loop Own/bot PR waiting on Codex review↔fix loop label Jul 29, 2026
@binaricat

Copy link
Copy Markdown
Owner Author

@codex review

@binaricat
binaricat marked this pull request as draft July 29, 2026 05:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 12c8e03541

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const electron = require("electron");

const appRoot = path.resolve(__dirname, "..");
const userData = fs.mkdtempSync(path.join(os.tmpdir(), "netcatty-xterm-decoration-perf-"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Put test user data in Netcatty's temp directory

When this live test is interrupted or exits before cleanup, the Electron profile remains directly under the system temp root, so Netcatty's cleanup and Settings visibility cannot find it. Allocate the test directory through tempDirBridge.getTempFilePath(...) instead of os.tmpdir(), as required for all temporary artifacts.

AGENTS.md reference: AGENTS.md:L140-L143

Useful? React with 👍 / 👎.

@netcatty-bot

Copy link
Copy Markdown
Collaborator

Automatic fix did not produce additional code changes for the latest Codex findings. Marking for human review.

@netcatty-bot netcatty-bot added ready-for-human Requires human implementation and removed automation:codex-loop Own/bot PR waiting on Codex review↔fix loop labels Jul 29, 2026
@binaricat binaricat added the automation:codex-loop Own/bot PR waiting on Codex review↔fix loop label Jul 29, 2026
@binaricat

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 5bf77adef9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@netcatty-bot
netcatty-bot marked this pull request as ready for review July 29, 2026 05:33
@netcatty-bot netcatty-bot added automation:bot-pr PR created or owned by Cursor automation automation:codex-clean Last Codex review reported clean and removed automation:codex-loop Own/bot PR waiting on Codex review↔fix loop ready-for-human Requires human implementation labels Jul 29, 2026
@netcatty-bot

Copy link
Copy Markdown
Collaborator

Codex reported no major issues. This PR is marked ready for human review/merge.

@binaricat
binaricat merged commit c3067c8 into main Jul 29, 2026
39 of 40 checks passed
@binaricat binaricat mentioned this pull request Jul 29, 2026
10 of 14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation:bot-pr PR created or owned by Cursor automation automation:codex-clean Last Codex review reported clean

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants