Skip to content

terminal: Improve regex hyperlink performance for long lines#44721

Merged
probably-neb merged 6 commits intozed-industries:mainfrom
davewa:terminal-hyperlink-long-line-perf
Dec 17, 2025
Merged

terminal: Improve regex hyperlink performance for long lines#44721
probably-neb merged 6 commits intozed-industries:mainfrom
davewa:terminal-hyperlink-long-line-perf

Conversation

@davewa
Copy link
Contributor

@davewa davewa commented Dec 12, 2025

Related to

This PR further improves performance for regex hyperlink finding by eliminating unnecessary regex matching. Currently, we repeatedly search for matches from the start of the line until the match contains the hovered point. This is only required to support custom regexes which match strings containing spaces, with multiple matches on a single line. This isn't actually a useful scenario, and is no longer supported. This PR changes to only search twice, the first match starting from the start of the line, and the hovered word (space-delimited). The most dramatic improvement is for long lines with many words.

In addition to the above changes, this PR:

Performance measurements

For the scenario from #44407, this improves the perf test's iteration time from 1.22ms to 0.47ms.

main:

Branch Command Iter/sec Mean [ms] SD [ms] Iterations Importance (weight)
main terminal_hyperlinks::tests::path::perf::pr_44407_hyperlink_benchmark 819.64 937.60 2.20 768 average (50)
this PR terminal_hyperlinks::tests::path::perf::pr_44407_hyperlink_benchmark 2099.79 1463.20 7.20 3072 average (50)

Release Notes:

  • terminal: Improve path hyperlink performance for long lines

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 12, 2025
@github-actions github-actions bot added the community champion Issues filed by our amazing community champions! 🫶 label Dec 12, 2025
@github-project-automation github-project-automation bot moved this to Community Champion PRs in Quality Week – December 2025 Dec 12, 2025
@davewa davewa marked this pull request as ready for review December 12, 2025 19:39
@probably-neb
Copy link
Collaborator

Is this ready to go @davewa? Or are you planning to knock out those "could be const" reviews before merging?

@probably-neb probably-neb moved this from Community Champion PRs to In progress in Quality Week – December 2025 Dec 17, 2025
@davewa
Copy link
Contributor Author

davewa commented Dec 17, 2025

Oh? I resolved those. Hhmmm….. It’s ready anyhow.

@probably-neb probably-neb merged commit 8aab646 into zed-industries:main Dec 17, 2025
23 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in Quality Week – December 2025 Dec 17, 2025
@probably-neb
Copy link
Collaborator

Great work as usual! Thanks!

HactarCE pushed a commit that referenced this pull request Dec 17, 2025
Related to
- #44407

This PR further improves performance for regex hyperlink finding by
eliminating unnecessary regex matching. Currently, we repeatedly search
for matches from the start of the line until the match contains the
hovered point. This is only required to support custom regexes which
match strings containing spaces, with multiple matches on a single line.
This isn't actually a useful scenario, and is no longer supported. This
PR changes to only search twice, the first match starting from the start
of the line, and the hovered word (space-delimited). The most dramatic
improvement is for long lines with many words.

In addition to the above changes, this PR:
- Adds test for the scenarios from #44407 and #44510 
- Simplifies the logic added in #44407

Performance measurements

For the scenario from #44407, this improves the perf test's iteration
time from 1.22ms to 0.47ms.

main:

| Branch | Command | Iter/sec | Mean [ms] | SD [ms] | Iterations |
Importance (weight) |
|:---|:---|---:|---:|---:|---:|---:|
| main |
terminal_hyperlinks::tests::path::perf::pr_44407_hyperlink_benchmark |
819.64 | 937.60 | 2.20 | 768 | average (50) |
| this PR |
terminal_hyperlinks::tests::path::perf::pr_44407_hyperlink_benchmark |
2099.79 | 1463.20 | 7.20 | 3072 | average (50) |

Release Notes:

- terminal: Improve path hyperlink performance for long lines
@davewa davewa deleted the terminal-hyperlink-long-line-perf branch December 18, 2025 15:05
rtfeldman pushed a commit that referenced this pull request Jan 5, 2026
Related to
- #44407

This PR further improves performance for regex hyperlink finding by
eliminating unnecessary regex matching. Currently, we repeatedly search
for matches from the start of the line until the match contains the
hovered point. This is only required to support custom regexes which
match strings containing spaces, with multiple matches on a single line.
This isn't actually a useful scenario, and is no longer supported. This
PR changes to only search twice, the first match starting from the start
of the line, and the hovered word (space-delimited). The most dramatic
improvement is for long lines with many words.

In addition to the above changes, this PR:
- Adds test for the scenarios from #44407 and #44510 
- Simplifies the logic added in #44407

Performance measurements

For the scenario from #44407, this improves the perf test's iteration
time from 1.22ms to 0.47ms.

main:

| Branch | Command | Iter/sec | Mean [ms] | SD [ms] | Iterations |
Importance (weight) |
|:---|:---|---:|---:|---:|---:|---:|
| main |
terminal_hyperlinks::tests::path::perf::pr_44407_hyperlink_benchmark |
819.64 | 937.60 | 2.20 | 768 | average (50) |
| this PR |
terminal_hyperlinks::tests::path::perf::pr_44407_hyperlink_benchmark |
2099.79 | 1463.20 | 7.20 | 3072 | average (50) |

Release Notes:

- terminal: Improve path hyperlink performance for long lines
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
…ustries#44721)

Related to
- zed-industries#44407

This PR further improves performance for regex hyperlink finding by
eliminating unnecessary regex matching. Currently, we repeatedly search
for matches from the start of the line until the match contains the
hovered point. This is only required to support custom regexes which
match strings containing spaces, with multiple matches on a single line.
This isn't actually a useful scenario, and is no longer supported. This
PR changes to only search twice, the first match starting from the start
of the line, and the hovered word (space-delimited). The most dramatic
improvement is for long lines with many words.

In addition to the above changes, this PR:
- Adds test for the scenarios from zed-industries#44407 and zed-industries#44510 
- Simplifies the logic added in zed-industries#44407

Performance measurements

For the scenario from zed-industries#44407, this improves the perf test's iteration
time from 1.22ms to 0.47ms.

main:

| Branch | Command | Iter/sec | Mean [ms] | SD [ms] | Iterations |
Importance (weight) |
|:---|:---|---:|---:|---:|---:|---:|
| main |
terminal_hyperlinks::tests::path::perf::pr_44407_hyperlink_benchmark |
819.64 | 937.60 | 2.20 | 768 | average (50) |
| this PR |
terminal_hyperlinks::tests::path::perf::pr_44407_hyperlink_benchmark |
2099.79 | 1463.20 | 7.20 | 3072 | average (50) |

Release Notes:

- terminal: Improve path hyperlink performance for long lines
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
…ustries#44721)

Related to
- zed-industries#44407

This PR further improves performance for regex hyperlink finding by
eliminating unnecessary regex matching. Currently, we repeatedly search
for matches from the start of the line until the match contains the
hovered point. This is only required to support custom regexes which
match strings containing spaces, with multiple matches on a single line.
This isn't actually a useful scenario, and is no longer supported. This
PR changes to only search twice, the first match starting from the start
of the line, and the hovered word (space-delimited). The most dramatic
improvement is for long lines with many words.

In addition to the above changes, this PR:
- Adds test for the scenarios from zed-industries#44407 and zed-industries#44510 
- Simplifies the logic added in zed-industries#44407

Performance measurements

For the scenario from zed-industries#44407, this improves the perf test's iteration
time from 1.22ms to 0.47ms.

main:

| Branch | Command | Iter/sec | Mean [ms] | SD [ms] | Iterations |
Importance (weight) |
|:---|:---|---:|---:|---:|---:|---:|
| main |
terminal_hyperlinks::tests::path::perf::pr_44407_hyperlink_benchmark |
819.64 | 937.60 | 2.20 | 768 | average (50) |
| this PR |
terminal_hyperlinks::tests::path::perf::pr_44407_hyperlink_benchmark |
2099.79 | 1463.20 | 7.20 | 3072 | average (50) |

Release Notes:

- terminal: Improve path hyperlink performance for long lines
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 community champion Issues filed by our amazing community champions! 🫶

Projects

Development

Successfully merging this pull request may close these issues.

3 participants