Skip to content

Instantly share code, notes, and snippets.

@stonecharioteer
Forked from disusered/profiler
Created January 6, 2022 12:13
Show Gist options
  • Save stonecharioteer/1d5eea7bd1fcd450daea77a64852cc56 to your computer and use it in GitHub Desktop.
Save stonecharioteer/1d5eea7bd1fcd450daea77a64852cc56 to your computer and use it in GitHub Desktop.
Profiling Neovim startup
#!/bin/bash
iterations=10
# -----------------------------------------------------------------------------
# Create array of results
declare -a results
for i in $(seq 1 $iterations);
do
nvim --startuptime vim.log -c 'q'
latest=$(awk '/./{line=$0} END{print line}' vim.log | awk '{ print $1}')
results+=( $latest )
done
# -----------------------------------------------------------------------------
# Calculate average
total=0
for delta in "${results[@]}"
do
total=`echo $total + $delta | bc -l`
done
average=`echo $total / $iterations | bc -l`
echo $average
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment