-
Notifications
You must be signed in to change notification settings - Fork 5.5k
terminal: Improve terminal hyperlink performance #40146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Just looking at this and the history of this issue it appears that the gains you are seeing are coming from criterion/alacrity. I think it would be good to describe at least briefly why those inclusions gain performance here even if it is a guess. The benchmarks are great but the history does benefit from the why explanation when looking back, this information can be valuable looking back sometimes. |
Thanks for looking at this. The gains come from replacing |
At a look I'd approve this. Haven't local tested but it looks solid. |
Performance issue discovered while working on #28238. This PR fixes terminal to only search the hovered line for hyperlinks and adds a benchmark. Before this fix, hyperlink detection grows linearly with terminal content, with this fix it is proportional only to the hovered line. The gains come from replacing
visible_regex_match_iter
, which searched all visible lines, with code that only searches the line hovered on.For a terminal with 4,000 lines like:
Compiling terminal v0.1.0 (/Hyperlinks/Bench/Source/zed-hyperlinks/crates/terminal)
Currently (on my M2 MacBook Air):
This PR:
Release Notes: