Closed itiut closed 5 years ago
This replaces basename and dirname with equivalent parameter expansions (${var:t} and ${var:h} respectively) mainly for speed.
basename
dirname
${var:t}
${var:h}
For benchmarking I measured zsh startup time with the following .zshrc (though this is an extreme case).
.zshrc
# .zshrc for i in {1..100}; do source ~/.zgen/zgen.zsh done
As a result, startup time was reduced by about 40%.
# before $ /usr/bin/time zsh -cli 'exit 0' 1.58 real 0.58 user 0.86 sys # after $ /usr/bin/time zsh -cli 'exit 0' 0.94 real 0.37 user 0.56 sys
Nice one!
Did you know that zsh has a builtin called repeat?
repeat
You can do:
repeat 100 {source ~/.zgen/zgen.zsh}
Thank you.
This replaces
basename
anddirname
with equivalent parameter expansions (${var:t}
and${var:h}
respectively) mainly for speed.For benchmarking I measured zsh startup time with the following
.zshrc
(though this is an extreme case).As a result, startup time was reduced by about 40%.