Skip to content

Commit

Permalink
Make perf testing easier
Browse files Browse the repository at this point in the history
  • Loading branch information
lildude committed Oct 16, 2021
1 parent 7cc8995 commit c120c47
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions modules/utility/functions/profzsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
shell=${1-$SHELL}
ZPROF=true $shell -i -c exit
10 changes: 10 additions & 0 deletions modules/utility/functions/timezsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Function for quickly timing ZSH startup
if (( $+commands[hyperfine] )); then
hyperfine --min-runs 10 --max-runs 10 --warmup 1 "zsh -i -c exit;"
else
echo "hyperfine not installed, using time instead..."
for i in $(seq 1 10); do time zsh -i -c exit; done
fi



6 changes: 3 additions & 3 deletions runcoms/zshrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# vim: set ft=zsh
# shellcheck shell=bash # Closest thing to zsh whilst shellcheck doesn't support zsh

# Profile loading the shell using `DEBUG_ZSH=1 zsh -i`
[ -z "$DEBUG_ZSH" ] || zmodload zsh/zprof
# Profile loading the shell using `ZPROF=1 zsh -i`
[ -z "$ZPROF" ] || zmodload zsh/zprof

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
Expand Down Expand Up @@ -83,5 +83,5 @@ HB_CNF_HANDLER="/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-f
[ -f "$HOME/.secrets" ] && source "$HOME/.secrets"

# This must always be last.
[ -z "$DEBUG_ZSH" ] || zprof
[ -z "$ZPROF" ] || zprof

0 comments on commit c120c47

Please sign in to comment.