summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-08 21:31:49 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-08 21:31:49 +0000
commit8c84716b24185c97d918080e5850a3694301e268 (patch)
tree6369e3efc6fb3aadd1e327544912bbd587cebc28
parent4b395bb4cecf23244617319a187391b7c885d864 (diff)
* 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
-rw-r--r--ChangeLog7
-rw-r--r--benchmark/bm_require.rb7
-rw-r--r--benchmark/bm_require_thread.rb15
-rw-r--r--benchmark/prepare_require.rb14
-rw-r--r--benchmark/prepare_require_thread.rb2
5 files changed, 45 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a8f2e62..02bd3ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/benchmark/bm_require.rb b/benchmark/bm_require.rb
new file mode 100644
index 0000000..b8abc88
--- /dev/null
+++ b/benchmark/bm_require.rb
@@ -0,0 +1,7 @@
+$:.push File.join(File.dirname(__FILE__), "bm_require.data")
+
+1.upto(10000) do |i|
+ require "c#{i}"
+end
+
+$:.pop
diff --git a/benchmark/bm_require_thread.rb b/benchmark/bm_require_thread.rb
new file mode 100644
index 0000000..e54db6c
--- /dev/null
+++ b/benchmark/bm_require_thread.rb
@@ -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
diff --git a/benchmark/prepare_require.rb b/benchmark/prepare_require.rb
new file mode 100644
index 0000000..40926df
--- /dev/null
+++ b/benchmark/prepare_require.rb
@@ -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
diff --git a/benchmark/prepare_require_thread.rb b/benchmark/prepare_require_thread.rb
new file mode 100644
index 0000000..339ecb8
--- /dev/null
+++ b/benchmark/prepare_require_thread.rb
@@ -0,0 +1,2 @@
+load File.join(File.dirname(__FILE__), "prepare_require.rb")
+