Skip to content

Instantly share code, notes, and snippets.

@dolmen
Forked from jaqque/prompt_timing.zsh
Last active December 18, 2015 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dolmen/5788893 to your computer and use it in GitHub Desktop.
Save dolmen/5788893 to your computer and use it in GitHub Desktop.
#!/bin/zsh
export TESTS=${TESTS:-1000000}
# liberated from liquidprompt
local ti_sgr0="$( { tput sgr0 || tput me ; } 2>/dev/null )"
local ti_bold="$( { tput bold || tput md ; } 2>/dev/null )"
if tput setaf >/dev/null 2>&1 ; then
ti_setaf () { tput setaf "$1" ; }
elif tput AF >/dev/null 2>&1 ; then
# *BSD
ti_setaf () { tput AF "$1" ; }
else
[[ "$_LP_SHELL" = bash ]] && echo "liquidprompt: terminal $TERM not supported" >&2
ti_setaf () { : ; }
fi
_LP_OPEN_ESC='%{';_LP_CLOSE_ESC='%}'
LP_COLORMAP_9="${_LP_OPEN_ESC}${ti_bold}$(ti_setaf 3 ; tput setab 1)${_LP_CLOSE_ESC}"
LP_COLORMAP_A='%{%B%F{yellow}%K{red}%}'
echo "Test 9"
typeset -i i
i=0
time ( while (( $i < $TESTS )); do
print -Pn "$LP_COLORMAP_9"
let i++
done )
echo
echo "Test A"
i=0
time ( while (( $i < $TESTS )); do
print -Pn "$LP_COLORMAP_A"
let i++
done )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment