Skip to content

Instantly share code, notes, and snippets.

@mloughran
Last active January 1, 2016 05:49
Show Gist options
  • Save mloughran/8100762 to your computer and use it in GitHub Desktop.
Save mloughran/8100762 to your computer and use it in GitHub Desktop.
Comparison of using run time & memory usage to run a ruby script that requires a single gem (which does nothing) then exits.
.bundle
bundle
vendor

Comparison of using run time & memory usage to run a ruby script that requires a single gem (which does nothing) then exits.

When standalone is available:

rm -rf ./bundle ./vendor ./.bundle
bundle --standalone
time ./test.rb

real	0m0.056s
user	0m0.041s
sys	0m0.012s

RSS: 6460 KB

When using vendor directory and require bundle/setup:

rm -rf ./bundle ./vendor ./.bundle
bundle --deployment
time ./test.rb

real	0m0.268s
user	0m0.230s
sys	0m0.037s

RSS: 17592 KB
source 'https://rubygems.org'
gem 'nothing'
GEM
remote: https://rubygems.org/
specs:
nothing (1.0.0)
PLATFORMS
ruby
DEPENDENCIES
nothing
#!/usr/bin/env ruby
begin
require_relative "bundle/bundler/setup"
rescue LoadError
$stderr.puts "Using bundler/setup"
require 'bundler/setup'
end
puts require 'nothing'
# sleep 200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment