`highlight_resolved_externals` slows down typing in `nushell` when computer is switched from AC to battery power
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 40.5k
- Forks
- 2.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 85
Description
Describe the bug
I've noticed that while using nushell, if I unplug my laptop, typing in the shell becomes very slow and laggy. If I set highlight_resolved_externals to false this issue does not arise.
How to reproduce
- Start a nushell session while connected to AC power
- Switch to battery power
- Type in session
Expected behavior
I expected nushell to remain as responsive as it was on AC power.
Screenshots
No response
Configuration
| key | value |
|---|---|
| version | 0.94.2 |
| major | 0 |
| minor | 94 |
| patch | 2 |
| branch | |
| commit_hash | be8c1dc0066cd1034a6b110a622f47b516bfe029 |
| build_os | windows-x86_64 |
| build_target | x86_64-pc-windows-msvc |
| rust_version | rustc 1.77.2 (25ef9e3d8 2024-04-09) |
| rust_channel | 1.77.2-x86_64-pc-windows-msvc |
| cargo_version | cargo 1.77.2 (e52e36006 2024-03-26) |
| build_time | 2024-06-03 19:27:48 +00:00 |
| build_rust_channel | release |
| allocator | mimalloc |
| features | default, sqlite, system-clipboard, trash, which |
| installed_plugins |
Additional context
I am running nushell via Windows Terminal (Preview).
Additionally, I feel as if I remember that the highlight_resolved_externals is making a which call each time to resolve those external commands. If that is the case, I realize that this may not be something that can be fixed necessarily, but was wondering if there was any workarounds, for example:
- A way to set the variable to false when running on battery power
- Supplement the performance of
whichby caching resolved externals - Changing the behavior of how often
whichis run? (Seems to be checking the whole command on keystroke) - Allow the externals resolver to be defined manually (Would allow users to define caching manually, use different strategies?)
I am open to any suggestions!
Thank you!
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
Start by tracing the highlight_resolved_externals path and the external-command resolution or which call described in the report. Reproduce the AC-to-battery transition on Windows with highlighting enabled, then determine whether the change should prevent per-keystroke slowdown, cache resolution, or document a workaround.
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
- Needs clarification
- Newbie friendliness
- 35/100