Perf issue: scrolling in the completion menu keeps triggering (re)parsing of the command line over and over
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 818
- Forks
- 249
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 30
Description
Platform macOS
Terminal software ghostty
Found this issue during https://github.com/nushell/nushell/pull/15270
Steps to reproduce
- type in
use std <tab> - hold ctrl-p/ctrl-n down for a while
rustc optimized nu release performs noticeably better.
Basically the menu next/prev event will trigger the parsing of the cli, which involves dozens of parse_module_file calls.
I guess it has something to do with the highlighting. But since the cli text doesn't change by those events (maybe I missed some config here to make it happen), I think it should be optimized.
Typing in cli after use std is also not very responsive due to the same reason, but that is probably harder to fix.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce with use std <tab> and held ctrl-p/ctrl-n in an optimized Rust release. Trace the menu next/prev event through highlighting and the repeated parse_module_file calls. Done means navigating the completion menu no longer reparses unchanged CLI text repeatedly and scrolling is responsive.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100