Skip to content

Commit fb04631

Browse files
committed
p10k: improve jj prompt latency
prompt_my_jj is run on every command and so affects command_lag_ms, whereas _my_jj_async runs in the background and doesn't, so it needs to be fast. this change removes the jj workspace root call which takes about 10ms
1 parent 4c74e43 commit fb04631

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ has_compsys=1
2626
has_syntax_highlighting=1
2727
has_autosuggestions=1
2828
has_git_prompt=1
29-
first_prompt_lag_ms=80.679
30-
first_command_lag_ms=557.900
31-
command_lag_ms=41.683
32-
input_lag_ms=6.921
33-
exit_time_ms=371.420
29+
first_prompt_lag_ms=89.379
30+
first_command_lag_ms=535.799
31+
command_lag_ms=28.222
32+
input_lag_ms=7.376
33+
exit_time_ms=357.432
3434
```

dotfiles/.p10k.zsh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,9 @@
16211621
local workspace
16221622

16231623
command -v jj >/dev/null 2>&1 || return
1624-
if workspace=$(jj workspace root 2>/dev/null); then
1624+
1625+
# check if we are in a jj repo
1626+
if [[ -n ./(../)#(.jj)(#qN/) ]]; then
16251627
p10k display "*/jj=show"
16261628
p10k display "*/vcs=hide"
16271629
else
@@ -1630,6 +1632,8 @@
16301632
return
16311633
fi
16321634

1635+
workspace=$PWD
1636+
16331637
# track current workspace for the async worker
16341638
if [[ $_my_jj_workspace != "$workspace" ]]; then
16351639
_my_jj_display=""

0 commit comments

Comments
 (0)