Skip to content
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

perf: definitely reduce scheduler task check to 10 second interval #435

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions zinit.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2390,12 +2390,15 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
# (delay), i.e. "burst" allows to run package installations from
# script, not from prompt.
@zinit-scheduler() {
integer ___ret="${${ZINIT[lro-data]%:*}##*:}"
integer ___ret="${${ZINIT[lro-data]%:*}##*:}" ___secs=$((${#${ZINIT_TASKS:#<no-data>}}>0?1:10))
# lro stands for lastarg-retval-option.
[[ $1 = following ]] && sched +1 'ZINIT[lro-data]="$_:$?:${options[printexitvalue]}"; @zinit-scheduler following "${ZINIT[lro-data]%:*:*}"'
[[ -n $1 && $1 != (following*|burst) ]] && { local THEFD="$1"; zle -F "$THEFD"; exec {THEFD}<&-; }
[[ $1 = following ]] && sched +$___secs 'ZINIT[lro-data]="$_:$?:${options[printexitvalue]}"; @zinit-scheduler following "${ZINIT[lro-data]%:*:*}"'
[[ -n $1 && $1 != (following*|burst) ]] && \
{ local THEFD="$1"; zle -F "$THEFD"; exec {THEFD}<&-; }
[[ $1 = burst ]] && local -h EPOCHSECONDS=$(( EPOCHSECONDS+10000 ))
ZINIT[START_TIME]="${ZINIT[START_TIME]:-$EPOCHREALTIME}"
# Return early if no actual tasks.
[[ -z ${ZINIT_TASKS:#<no-data>} ]] && return 0

integer ___t=EPOCHSECONDS ___i correct
local -a match mbegin mend reply
Expand Down Expand Up @@ -3276,6 +3279,8 @@ typeset -g REPLY

# a searchable menu of tags for current directory
zinit null light-mode autoload'zi-browse-symbol' for %$ZINIT[BIN_DIR]
ZINIT_REGISTERED_PLUGINS[-1]=()

zle -N zi-browse-symbol
zle -N zi-browse-symbol-backwards zi-browse-symbol
zle -N zi-browse-symbol-pbackwards zi-browse-symbol
Expand Down