Skip to content

Instantly share code, notes, and snippets.

@ichizok
Created October 5, 2013 07:04
Show Gist options
  • Save ichizok/6837649 to your computer and use it in GitHub Desktop.
Save ichizok/6837649 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
gen_vimrc() {
cat <<EOT
function! s:startup()
let dirs = []
for i in range(${1%_*})
call add(dirs, printf('testdir/test-$1/dir%03d', i))
endfor
let &rtp = join(dirs, ',')
endfunction
call s:startup()
$(
for i in $(seq 0 "${2:-0}"); do
echo "call script$i#nop()"
done
)
EOT
}
for vim in vim[0-9]; do
mkdir -p "startup/$vim"
for k in 1_1000 10_100 100_10 1000_1; do
vimrc="$(mktemp "${TMPDIR:-/tmp}/vimrc.XXXXXX")"
if [[ ! -f "$vimrc" ]]; then
echo "Could not create vimrc" >&2
continue
fi
gen_vimrc "$k" "$1" >"$vimrc"
result="startup/$vim/result-$k.txt"
./"$vim" -u "$vimrc" -N --startuptime "$result" -c q
cat <<EOT
$vim $k result: $(printf "% 10s" "$(tail -n1 "$result" | cut -d' ' -f1)")
EOT
rm -f "$vimrc"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment