Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Benchmark for ruby require performance with LOAD_PATH

View full_load_path_benchmark.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
$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
View full_load_path_benchmark.rb
1 2 3 4
`mkdir f`
10000.times do |x|
`touch f/bogus#{x}.rb`
end
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.