nathanshelly / .files

.💙
16 stars 8 forks source link

Improve shell speed (initial load & prompt rendering) #5

Closed nathanshelly closed 5 years ago

nathanshelly commented 5 years ago

This PR includes a bunch of changes detailed below. Up front here are the top level results:

Benchmarks

Initial load

The time to start a new shell (when opening a terminal emulator for the first time, opening a new tmux pane or running zsh). Benchmarked with hyperfine: hyperfine 'zsh -i -c "exit 0"' --warmup 3 --export-markdown startup.md.

Branch Command Mean [ms] Min [ms] Max [ms] Relative
curent master zsh -i -c exit 302.8 ± 27.0 278.9 347.8 1.0
speed (this PR branch) zsh -i -c exit 91.7 ± 12.0 79.4 144.3 1.0

This PR improves initial load time by ~3x.

Prompt rendering

Time to render a new prompt after running a command. Benchmarked with zsh-prompt-benchmark in two different repositories (this repo & the linux kernel).

Repo Branch Latency (ms)
.files (this repo) current master 219.96
.files (this repo) speed (this PR branch) 45.67
linux kernel current master 1536.35
linux kernel speed (this PR branch) 38.48

This PR improves prompt rendering time by ~5-500x depending on the repo size.

Changelog