Skip to content

terminal: Fix performance issues with hyperlink regex matching (#44407) (cherry-pick to preview)#44423

Merged
zed-zippy[bot] merged 1 commit intov0.216.xfrom
cherry-pick-v0.216.x-3d6cc3dc
Dec 8, 2025
Merged

terminal: Fix performance issues with hyperlink regex matching (#44407) (cherry-pick to preview)#44423
zed-zippy[bot] merged 1 commit intov0.216.xfrom
cherry-pick-v0.216.x-3d6cc3dc

Conversation

@zed-zippy
Copy link
Contributor

@zed-zippy zed-zippy bot commented Dec 8, 2025

Cherry-pick of #44407 to preview


Problem statement: When given a line that contained a lot of matches of
your hyperlink regex of choice (thanks to #40305), we would look for
matches
that intersected with currently hovered point. This is hella
expensive, because we would re-walk the whole alacritty grid for each
match. With the repro that Joseph shared, we had to go through 4000 such
matches on each frame render.

Problem solution: We now convert the hovered point into a range within
the line (byte-wise) in order to throw away matches that do not
intersect the
hovered range. This lets us avoid performing the unnecessary conversion
when we know it's never going to yield a match range that intersects the
hovered point.

Release Notes:

  • terminal: Fixed performance regression when handling long lines.

Co-authored-by: Dave Waggoner waggoner.dave@gmail.com

Problem statement: When given a line that contained a lot of matches of
your hyperlink regex of choice (thanks to #40305), we would look for
matches
that intersected with currently hovered point. This is *hella*
expensive, because we would re-walk the whole alacritty grid for each
match. With the repro that Joseph shared, we had to go through 4000 such
matches on each frame render.

Problem solution: We now convert the hovered point into a range within
the line (byte-wise) in order to throw away matches that do not
intersect the
hovered range. This lets us avoid performing the unnecessary conversion
when we know it's never going to yield a match range that intersects the
hovered point.

Release Notes:

- terminal: Fixed performance regression when handling long lines.

---------

Co-authored-by: Dave Waggoner <waggoner.dave@gmail.com>
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 8, 2025
@zed-zippy zed-zippy bot merged commit 716983b into v0.216.x Dec 8, 2025
23 checks passed
@zed-zippy zed-zippy bot deleted the cherry-pick-v0.216.x-3d6cc3dc branch December 8, 2025 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant