Last active
July 17, 2019 01:55
-
-
Save inopinatus/9c6f98e2e9aa43b0f86eef4ad6b14401 to your computer and use it in GitHub Desktop.
crude little benchmark for parallelizing bundle-installed gems
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TMPDIR="$(mktemp -d)" | |
CORES=$(sysctl -n hw.ncpu 2>/dev/null || nproc) | |
echo "==> testing with $CORES cores in $TMPDIR" | |
cd $TMPDIR | |
RUBY_VERSION=$(rbenv version-name) | |
TIME=$(which time) | |
function run { | |
export MAKEFLAGS="-j$1" | |
export BUNDLE_JOBS="$2" | |
export GEMSET="gems_${RUBY_VERSION}_make${MAKEFLAGS}_bundle-jobs-${BUNDLE_JOBS}" | |
echo "==> installing Rails for $GEMSET" | |
echo "./${GEMSET} global" >.ruby-gemset | |
$TIME ruby -r bundler/inline -e 'gemfile { source "https://rubygems.org"; gem "rails", "6.0.0.rc1" }' | |
} | |
run 1 1 | |
run 1 $CORES | |
run $CORES 1 | |
run $CORES $CORES | |
echo '==> cleaning up' | |
rm -rf "$TMPDIR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment