diff --git a/Gemfile b/Gemfile index 851fabc2..25b40ed2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,2 +1,7 @@ source 'https://rubygems.org' gemspec + +if ENV['BENCHMARK'] + gem 'rbtrace' + gem 'stackprof' +end diff --git a/script/benchmark b/script/benchmark new file mode 100755 index 00000000..32c89ac3 --- /dev/null +++ b/script/benchmark @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -e + +export BENCHMARK=true +script/bootstrap + +TEST_SCRIPT="Jekyll::Commands::Build.process({'source' => 'site'})" +PROF_OUTPUT_FILE=tmp/stackprof-$(date +%Y%m%d).dump + +bundle exec ruby -r./lib/jekyll -rstackprof -e "StackProf.run(mode: :cpu, out: '${PROF_OUTPUT_FILE}') { ${TEST_SCRIPT} }" + +bundle exec stackprof $PROF_OUTPUT_FILE $@