Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Benchmark for ruby require performance with LOAD_PATH
$LOAD_PATH.unshift(File.expand_path('f'))
x = 0
y = 0
require 'benchmark'
Benchmark.bm do |b|
step = 500
(0..4).each do |n|
b.report("#{n * step} in load path") { 50.times { require "bogus#{x}"; x += 1 }}
step.times do
$LOAD_PATH.unshift("/tmp/folder#{y}")
y += 1
end
$LOADED_FEATURES.clear
$stdout.flush
end
end
`mkdir f`
10000.times do |x|
`touch f/bogus#{x}.rb`
end
@xaviershay

This comment has been minimized.

Show comment
Hide comment
Owner

xaviershay commented May 22, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment