-
Notifications
You must be signed in to change notification settings - Fork 42
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
Use retained mode rendering for better performance #279
Comments
Hi, The slow rendering you're experiencing is most probably caused by the |
Unfortunately I can't share the data itself as it's a file listing on a private project, however the number of lines is ~3k and the number of matches decreases quite quickly after the first few keystrokes (about half the files start with the same prefix).
I added some debug measurements and that doesn't seem to be the case, unless I'm a really fast at typing or rusty at timing stuff in C. It seems like most of the time is spent in printing stuff out to the tty, often taking around half a second to print, while input processing takes 0-10 (mostly 0) milliseconds for each keystroke, indicating that stuff is coming in faster than it can print. Which leads me to:
I'm not indicating that there should be any added delay, just to keep reading the input and updating state until the tty has no more data buffered, and only then render the results. Can also be capped at a time limit (e.g. 1/60s) to allow intermediate renders when the dataset is huge and the search actually takes long. |
Interesting, do you happen to have a large terminal window? What's the $ stty size |
Yeah, I'm using a small scale on my MPB, so
|
Does the |
Yeah, it does return |
I have to do some measurements first in order to verify that the changes
I doubt this change would cause a noticeable increase in performance. |
I'd really like this to work on macOS as well. Does |
Anyone runing macOS willing to look further into this? /cc @jussi-kalliokoski @calleerlandsson @mike-burns |
Not running macOS but I might be able to find someone at thoughtbot NYC who is willing to try this. For clarity, the experiment is: iTerm 2, 3500 lines of input, typing three characters should get it down to a few lines of input quickly. yes | head -3500 > foo
echo no >> foo
echo no >> foo
echo no >> foo
cat foo | pick ? |
Sorry I was referring to kqueue() and select() on macOS and if they |
Sorry, been pretty busy for a while, might have a moment next week to test |
Ping @jussi-kalliokoski |
Currently with large lists
pick
gets really slow on terminals that take a lot of time to render (I'm using iTerm2). Would be cool to avoid useless renders in between keystrokes in those cases, e.g. you type abcdefgh quickly and all of those are rendered and in some cases it can take seconds for the final list to be rendered.The text was updated successfully, but these errors were encountered: