nathanshelly / .files

.💙
16 stars 8 forks source link

shell speed tracking thread #56

Open nathanshelly opened 4 years ago

nathanshelly commented 4 years ago

rough breakdown of shell startup time

as of https://github.com/nathanshelly/.files/commit/856e1420b71afa5b12d256cf37aa44cacd69a075

Times measured via hyperfine 'zsh -i -c exit' --warmup 5 run outside of tmux. See individual results below (gathered using --export-json).

config time (ms) commented out lines
full setup 227.1 ms ± 10.8 ms n/a
w/o distributed config files 142.0 ms ± 4.1 ms https://github.com/nathanshelly/.files/blob/856e1420b71afa5b12d256cf37aa44cacd69a075/zsh/zshrc.symlink#L50-L53
w/o functions 167.2 ms ± 6.4 ms https://github.com/nathanshelly/.files/blob/856e1420b71afa5b12d256cf37aa44cacd69a075/zsh/zshrc.symlink#L30
w/o all plugins (includes prompt) 184.8 ms ± 5.0 ms https://github.com/nathanshelly/.files/blob/856e1420b71afa5b12d256cf37aa44cacd69a075/zsh/zshrc.symlink#L36-L38
w/o misc lines (that have not already appeared in this table) 190.8 ms ± 5.4 ms https://github.com/nathanshelly/.files/blob/856e1420b71afa5b12d256cf37aa44cacd69a075/zsh/zshrc.symlink#L20-L24 & https://github.com/nathanshelly/.files/blob/856e1420b71afa5b12d256cf37aa44cacd69a075/zsh/zshrc.symlink#L33 & https://github.com/nathanshelly/.files/blob/856e1420b71afa5b12d256cf37aa44cacd69a075/zsh/zshrc.symlink#L63
w/o prompt only 196.7 ms ± 6.6 ms https://github.com/nathanshelly/.files/blob/856e1420b71afa5b12d256cf37aa44cacd69a075/zsh/zshrc.symlink#L38 & https://github.com/nathanshelly/.files/blob/856e1420b71afa5b12d256cf37aa44cacd69a075/zsh/plugins.zsh#L65-L66
w/o asdf 206.0 ms ± 5.1 ms https://github.com/nathanshelly/.files/blob/856e1420b71afa5b12d256cf37aa44cacd69a075/zsh/zshrc.symlink#L65
w/o direnv 214.5 ms ± 5.6 ms https://github.com/nathanshelly/.files/blob/856e1420b71afa5b12d256cf37aa44cacd69a075/zsh/zshrc.symlink#L58

rough breakdown of time spent per significant pieces

based on above test runs (all times are simply the difference between a run with the full setup and a run without the specified component).

The below percentages don't add up to exactly because 🤷‍♂️ (these timings aren't the precisest). I'm most suspicious about the "misc lines" result (though not with any particular justification).

piece time (ms) % of ~230 ms full setup run above
distributed files ~90 ms 39.13 %
functions ~60 ms 26.09 %
all plugins (includes prompt) ~40 ms 17.39 %
misc lines ~40 ms 17.39 %
asdf ~20 ms 8.70 %
direnv ~10 ms 4.34 %
--- --- ---
total 260 ms 113.04 %

individual plugins

piece time (ms) % of total (~230 ms)
prompt only ~30 ms 13.04 %

resources

nathanshelly commented 4 years ago

individual results

full setup ```json { "results": [ { "command": "zsh -i -c exit", "mean": 0.22708054984333337, "stddev": 0.010767368822979037, "median": 0.22401727776000002, "user": 0.08157967666666667, "system": 0.14695346499999998, "min": 0.21373556126, "max": 0.24543183826, "times": [ 0.24543183826, 0.22475546726, 0.21373556126, 0.24239513026, 0.21846412826000003, 0.22327908826, 0.21558919126, 0.23899318826000002, 0.22937645426000003, 0.23352734526000002, 0.21862621026, 0.22079299526 ] } ] } ```
w/o distributed files ```json { "results": [ { "command": "zsh -i -c exit", "mean": 0.14201949998973684, "stddev": 0.0041442400713378345, "median": 0.14123775309500003, "user": 0.05681271105263158, "system": 0.0860492097368421, "min": 0.135240583095, "max": 0.151173216095, "times": [ 0.15041939509500002, 0.14123775309500003, 0.14101029609500002, 0.14430055809500003, 0.14479771509500003, 0.14476191709500003, 0.143271958095, 0.14005166809500003, 0.137396040095, 0.151173216095, 0.145441126095, 0.14183928009500002, 0.13976016909500003, 0.13980840809500003, 0.14230431009500003, 0.13924482509500002, 0.135240583095, 0.137616773095, 0.13869450809500003 ] } ] } ```
w/o functions ```json { "results": [ { "command": "zsh -i -c exit", "mean": 0.16715034824500002, "stddev": 0.00635077917050683, "median": 0.16636151962, "user": 0.0686144475, "system": 0.09995945749999997, "min": 0.15767520712, "max": 0.18287538311999998, "times": [ 0.17679501011999998, 0.15767520712, 0.16526101512, 0.16779572912, 0.16259754012, 0.16188346112, 0.16624406712, 0.16215152112, 0.18287538311999998, 0.16647897211999999, 0.16565256812, 0.16781478712, 0.16718893112, 0.16687997512, 0.16186663112, 0.17524477312 ] } ] } ```
w/o all plugins ```json { "results": [ { "command": "zsh -i -c exit", "mean": 0.1848401257266667, "stddev": 0.004964661414074099, "median": 0.18576992146000001, "user": 0.05437459666666666, "system": 0.12590256, "min": 0.17579416146000001, "max": 0.19196211546000003, "times": [ 0.19196211546000003, 0.18105305346, 0.17579416146000001, 0.19094710046000002, 0.18945760646, 0.17825828246, 0.18784953346000002, 0.18810943946, 0.18576992146000001, 0.18243218446, 0.18261044546000002, 0.18903287546, 0.18038019946, 0.18079012746, 0.18815483946 ] } ] } ```
w/o misc lines ```json { "results": [ { "command": "zsh -i -c exit", "mean": 0.19084922057142856, "stddev": 0.005409755081814958, "median": 0.18922580650000004, "user": 0.06753546214285715, "system": 0.12530040571428572, "min": 0.18428575900000002, "max": 0.20089504500000002, "times": [ 0.20089504500000002, 0.18884519400000002, 0.18936431800000003, 0.19884241500000002, 0.186500146, 0.18428575900000002, 0.19327558100000003, 0.18908729500000002, 0.188183118, 0.19985872300000002, 0.189436599, 0.185312308, 0.19131139700000002, 0.18669119 ] } ] } ```
w/o prompt ```json { "results": [ { "command": "zsh -i -c exit", "mean": 0.19673619216500002, "stddev": 0.006582376509561284, "median": 0.19647979116500003, "user": 0.06527242357142857, "system": 0.12695851214285717, "min": 0.18088898716500001, "max": 0.20999311416500002, "times": [ 0.20999311416500002, 0.195067937165, 0.19836367716500003, 0.19400410716500002, 0.199282723165, 0.199892873165, 0.20509480516500003, 0.191340181165, 0.18088898716500001, 0.19731861816500001, 0.19426079816500003, 0.19583928616500001, 0.19591041916500002, 0.197049163165 ] } ] } ```
w/o `direnv` ```json { "results": [ { "command": "zsh -i -c exit", "mean": 0.21452833238576924, "stddev": 0.005610608263326967, "median": 0.21511448615500003, "user": 0.07656503384615385, "system": 0.14021890384615385, "min": 0.20729261915500002, "max": 0.22580478015500002, "times": [ 0.22116597815500003, 0.21511448615500003, 0.21072207115500002, 0.21935090815500002, 0.21651549015500002, 0.20729261915500002, 0.21576133915500004, 0.20781597515500003, 0.20864015915500003, 0.21177776915500002, 0.21103912015500004, 0.22580478015500002, 0.21786762515500002 ] } ] } ```
w/o `asdf` ```json { "results": [ { "command": "zsh -i -c exit", "mean": 0.20602205136307694, "stddev": 0.005147858995112704, "median": 0.20458756844, "user": 0.07410254653846152, "system": 0.13379787884615385, "min": 0.20092230044, "max": 0.21887002644000003, "times": [ 0.21887002644000003, 0.20092230044, 0.21120903444000003, 0.20217508644, 0.20620183844, 0.21026765744, 0.20178015944000002, 0.20458756844, 0.20389554044000002, 0.20167848244000003, 0.20706503144000002, 0.20167580844000002, 0.20795813344000003 ] } ] } ```