mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* benchmark/bm_require.rb: new benchmark for require.
* benchmark/bm_require_thread.rb: new benchmark for conflicting require vs thread. like [Bug #11559] * prepare_require.rb: new file for preparing above tests. * prepare_require.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4b395bb4ce
commit
8c84716b24
5 changed files with 45 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
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
|
||||
require vs thread. like [Bug #11559]
|
||||
* prepare_require.rb: new file for preparing above tests.
|
||||
* prepare_require.rb: ditto.
|
||||
|
||||
Thu Oct 8 14:10:45 2015 Zachary Scott <zzak@ruby-lang.org>
|
||||
|
||||
* ext/openssl/lib/openssl/ssl.rb: Default to TLSv1.2 and drop TLS v1
|
||||
|
|
7
benchmark/bm_require.rb
Normal file
7
benchmark/bm_require.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
$:.push File.join(File.dirname(__FILE__), "bm_require.data")
|
||||
|
||||
1.upto(10000) do |i|
|
||||
require "c#{i}"
|
||||
end
|
||||
|
||||
$:.pop
|
15
benchmark/bm_require_thread.rb
Normal file
15
benchmark/bm_require_thread.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
$:.push File.join(File.dirname(__FILE__), "bm_require.data")
|
||||
|
||||
i=0
|
||||
t = Thread.new do
|
||||
while true
|
||||
i = i+1 # dummy loop
|
||||
end
|
||||
end
|
||||
|
||||
1.upto(100) do |i|
|
||||
require "c#{i}"
|
||||
end
|
||||
|
||||
$:.pop
|
||||
t.kill
|
14
benchmark/prepare_require.rb
Normal file
14
benchmark/prepare_require.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
require "fileutils"
|
||||
|
||||
basename = File.dirname($0)
|
||||
data_dir = File.join(basename, "bm_require.data")
|
||||
|
||||
FileUtils.mkdir_p(data_dir)
|
||||
|
||||
1.upto(10000) do |i|
|
||||
f = File.open("#{data_dir}/c#{i}.rb", "w")
|
||||
f.puts <<-END
|
||||
class C#{i}
|
||||
end
|
||||
END
|
||||
end
|
2
benchmark/prepare_require_thread.rb
Normal file
2
benchmark/prepare_require_thread.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
load File.join(File.dirname(__FILE__), "prepare_require.rb")
|
||||
|
Loading…
Reference in a new issue