Skip to content

perf(ui): optimize terminal cell width measurement (#579)#586

Open
kazu728 wants to merge 1 commit into
modem-dev:mainfrom
kazu728:patch
Open

perf(ui): optimize terminal cell width measurement (#579)#586
kazu728 wants to merge 1 commit into
modem-dev:mainfrom
kazu728:patch

Conversation

@kazu728

@kazu728 kazu728 commented Jul 23, 2026

Copy link
Copy Markdown

In measureSanitizedTextWidth (src/ui/lib/text.ts), non-ASCII text falls to string-width, which classifies every grapheme cluster via /^\p{RGI_Emoji}$/v. So plain Japanese pays emoji-detection cost too, and that v-flag regex is pathologically slow on Bun.

@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

Comment thread package.json
"chokidar": "^4.0.3",
"commander": "^14.0.3",
"diff": "^8.0.3",
"get-east-asian-width": "^1.5.0",

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Relying on implicit transitive dependencies can cause confusion, so I added get-east-asian-width as an explicit dependency. It was already included transitively via string-width.

@kazu728 kazu728 changed the title perf(ui): speed up terminal cell width measurement (#579) perf(ui): optimize terminal cell width measurement (#579) Jul 23, 2026
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