You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Atuin integration with Bash/Zsh did not slow down the shell.
I expected the same with Nushell.
What happened?
There is a noticeable delay after the invoked command's completion and before the new shell prompt shows up.
Even when running a very simple command like ls which takes less than a millisecond.
~
❯ atuin history list | lines | length
8795
~
❯ timeit do { atuin history end --exit 0 (atuin history start -- ls) }
243ms 217µs 340ns
~
❯ mv ~/.local/share/atuin/ ~/.local/share/atuin.backup
~
❯ atuin history list | lines | length
1
~
❯ timeit do { atuin history end --exit 0 (atuin history start -- ls) }
20ms 317µs 702ns
I have 8.8k history records and atuin history start + atuin history end pair take around 240ms.
After nuking the DB at ~/.local/share/atuin that time is reduced to 20ms and the delay is no longer noticeable.
The prompt was instantaneous regardless of the history size on the other shells (Bash/Zsh).
So I assume this has to do with Nushell integration specifically.
WieeRd
changed the title
[Bug]: Nushell integration adds a significantly delay before each prompt
[Bug]: Nushell integration adds a significant delay before each prompt
Jul 31, 2024
The vast majority of the delay comes from querying the SQLite database, which is not affected by the shell I'm using. The difference is that while other integration scripts for other shells seem to hide this delay from the user by running history start/stop in the background, Nushell has to wait the whole time until the query completes.
Nushell does not support background task or job control yet.
Instead, it recommends the use of 3rd party job control tools like pueue.
So what we can do right now on the Atuin's side, before the official support for job control, is to detect if pueue is available and run the history commands through it. Falling back to the blocking call if it's unavailable and potentially printing out warnings about the delay.
Enabling the experiment Atuin daemon significantly cut down the delay, as the hook commands can just ask the daemon to do the work and be on their way without waiting for the query to finish.
Until Nushell implements job control this would be the best method to mitigate this problem.
What did you expect to happen?
Atuin integration with Bash/Zsh did not slow down the shell.
I expected the same with Nushell.
What happened?
There is a noticeable delay after the invoked command's completion and before the new shell prompt shows up.
Even when running a very simple command like
ls
which takes less than a millisecond.I have 8.8k history records and
atuin history start
+atuin history end
pair take around 240ms.After nuking the DB at
~/.local/share/atuin
that time is reduced to 20ms and the delay is no longer noticeable.The prompt was instantaneous regardless of the history size on the other shells (Bash/Zsh).
So I assume this has to do with Nushell integration specifically.
Atuin doctor output
Code of Conduct
The text was updated successfully, but these errors were encountered: