2015-10-09 00:31:49 +03:00
|
|
|
require "fileutils"
|
|
|
|
|
2015-10-09 00:53:48 +03:00
|
|
|
def prepare
|
|
|
|
num_files = 10000
|
2015-10-09 00:31:49 +03:00
|
|
|
|
2015-10-09 00:53:48 +03:00
|
|
|
basename = File.dirname($0)
|
|
|
|
data_dir = File.join(basename, "bm_require.data")
|
2015-10-09 00:31:49 +03:00
|
|
|
|
2015-10-09 00:53:48 +03:00
|
|
|
# skip if all of files exists
|
|
|
|
if File.exist?(File.join(data_dir, "c#{num_files}.rb"))
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
FileUtils.mkdir_p(data_dir)
|
|
|
|
|
|
|
|
1.upto(num_files) do |i|
|
|
|
|
f = File.open("#{data_dir}/c#{i}.rb", "w")
|
|
|
|
f.puts <<-END
|
2015-10-09 00:31:49 +03:00
|
|
|
class C#{i}
|
|
|
|
end
|
|
|
|
END
|
2015-10-09 00:53:48 +03:00
|
|
|
end
|
2015-10-09 00:31:49 +03:00
|
|
|
end
|
2015-10-09 00:53:48 +03:00
|
|
|
|
|
|
|
prepare
|