Skip to content

Commit d2a158d

Browse files
committed
perf: definitely reduce scheduler task check to 10 second interval
Related issue: #429
1 parent cfd3261 commit d2a158d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

zinit.zsh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2390,12 +2390,15 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
23902390
# (delay), i.e. "burst" allows to run package installations from
23912391
# script, not from prompt.
23922392
@zinit-scheduler() {
2393-
integer ___ret="${${ZINIT[lro-data]%:*}##*:}"
2393+
integer ___ret="${${ZINIT[lro-data]%:*}##*:}" ___secs=$((${#${ZINIT_TASKS:#<no-data>}}>1?1:10))
23942394
# lro stands for lastarg-retval-option.
2395-
[[ $1 = following ]] && sched +1 'ZINIT[lro-data]="$_:$?:${options[printexitvalue]}"; @zinit-scheduler following "${ZINIT[lro-data]%:*:*}"'
2396-
[[ -n $1 && $1 != (following*|burst) ]] && { local THEFD="$1"; zle -F "$THEFD"; exec {THEFD}<&-; }
2395+
[[ $1 = following ]] && sched +$___secs 'ZINIT[lro-data]="$_:$?:${options[printexitvalue]}"; @zinit-scheduler following "${ZINIT[lro-data]%:*:*}"'
2396+
[[ -n $1 && $1 != (following*|burst) ]] && \
2397+
{ local THEFD="$1"; zle -F "$THEFD"; exec {THEFD}<&-; }
23972398
[[ $1 = burst ]] && local -h EPOCHSECONDS=$(( EPOCHSECONDS+10000 ))
23982399
ZINIT[START_TIME]="${ZINIT[START_TIME]:-$EPOCHREALTIME}"
2400+
# Return early if no actual tasks.
2401+
[[ -z ${ZINIT_TASKS:#<no-data>} ]] && return 0
23992402

24002403
integer ___t=EPOCHSECONDS ___i correct
24012404
local -a match mbegin mend reply
@@ -3276,6 +3279,8 @@ typeset -g REPLY
32763279

32773280
# a searchable menu of tags for current directory
32783281
zinit null light-mode autoload'zi-browse-symbol' for %$ZINIT[BIN_DIR]
3282+
ZINIT_REGISTERED_PLUGINS[-1]=()
3283+
32793284
zle -N zi-browse-symbol
32803285
zle -N zi-browse-symbol-backwards zi-browse-symbol
32813286
zle -N zi-browse-symbol-pbackwards zi-browse-symbol

0 commit comments

Comments
 (0)