reedline icon indicating copy to clipboard operation
reedline copied to clipboard

Perf issue: scrolling in the completion menu keeps triggering (re)parsing of the command line over and over

Open blindFS opened this issue 9 months ago • 3 comments

Platform macOS Terminal software ghostty

Found this issue during https://github.com/nushell/nushell/pull/15270

Steps to reproduce

  1. type in use std <tab>
  2. 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.

blindFS avatar Mar 09 '25 03:03 blindFS

Nice catch. Would be wonderful to figure out how to fix this.

fdncred avatar Mar 09 '25 12:03 fdncred

Ideally, highlighting better to be an async function and then we can set a debounce timeout for it.

I'm not sure if it worth the effort, since the only remaining situation that I can notice the lagging (but I only tested it on M4 pro chip) is use std <typing/left/right>. And that one seems to me a nu_parser issue.

blindFS avatar Mar 15 '25 11:03 blindFS

i would love to see some asyn in reedline to fix things like this and be a bit more powerful

fdncred avatar May 27 '25 11:05 fdncred