зеркало из https://github.com/github/ruby.git
* benchmark/prepare_require.rb: skip file creation if it already
exist. Suggested by ko1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
ae85869506
Коммит
68c35d8bb9
|
@ -1,3 +1,8 @@
|
|||
Fri Oct 9 06:52:49 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* benchmark/prepare_require.rb: skip file creation if it already
|
||||
exist. Suggested by ko1.
|
||||
|
||||
Fri Oct 9 06:18:04 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
* benchmark/bm_require.rb: new benchmark for require.
|
||||
* benchmark/bm_require_thread.rb: new benchmark for conflicting
|
||||
|
|
|
@ -1,14 +1,25 @@
|
|||
require "fileutils"
|
||||
|
||||
basename = File.dirname($0)
|
||||
data_dir = File.join(basename, "bm_require.data")
|
||||
def prepare
|
||||
num_files = 10000
|
||||
|
||||
FileUtils.mkdir_p(data_dir)
|
||||
basename = File.dirname($0)
|
||||
data_dir = File.join(basename, "bm_require.data")
|
||||
|
||||
1.upto(10000) do |i|
|
||||
f = File.open("#{data_dir}/c#{i}.rb", "w")
|
||||
f.puts <<-END
|
||||
# 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
|
||||
class C#{i}
|
||||
end
|
||||
END
|
||||
end
|
||||
end
|
||||
|
||||
prepare
|
||||
|
|
Загрузка…
Ссылка в новой задаче