[前][次][番号順一覧][スレッド一覧]

ruby-changes:40002

From: kosaki <ko1@a...>
Date: Fri, 9 Oct 2015 06:32:15 +0900 (JST)
Subject: [ruby-changes:40002] kosaki:r52083 (trunk): * benchmark/bm_require.rb: new benchmark for require.

kosaki	2015-10-09 06:31:49 +0900 (Fri, 09 Oct 2015)

  New Revision: 52083

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52083

  Log:
    * 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.

  Added files:
    trunk/benchmark/bm_require.rb
    trunk/benchmark/bm_require_thread.rb
    trunk/benchmark/prepare_require.rb
    trunk/benchmark/prepare_require_thread.rb
  Modified files:
    trunk/ChangeLog
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52082)
+++ ChangeLog	(revision 52083)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Oct  9 06:18:04 2015  KOSAKI Motohiro  <kosaki.motohiro@g...>
+	* 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@r...>
 
 	* ext/openssl/lib/openssl/ssl.rb: Default to TLSv1.2 and drop TLS v1
Index: benchmark/prepare_require_thread.rb
===================================================================
--- benchmark/prepare_require_thread.rb	(revision 0)
+++ benchmark/prepare_require_thread.rb	(revision 52083)
@@ -0,0 +1,2 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/prepare_require_thread.rb#L1
+load File.join(File.dirname(__FILE__), "prepare_require.rb")
+
Index: benchmark/prepare_require.rb
===================================================================
--- benchmark/prepare_require.rb	(revision 0)
+++ benchmark/prepare_require.rb	(revision 52083)
@@ -0,0 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/prepare_require.rb#L1
+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
Index: benchmark/bm_require_thread.rb
===================================================================
--- benchmark/bm_require_thread.rb	(revision 0)
+++ benchmark/bm_require_thread.rb	(revision 52083)
@@ -0,0 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_require_thread.rb#L1
+$:.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
Index: benchmark/bm_require.rb
===================================================================
--- benchmark/bm_require.rb	(revision 0)
+++ benchmark/bm_require.rb	(revision 52083)
@@ -0,0 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_require.rb#L1
+$:.push File.join(File.dirname(__FILE__), "bm_require.data")
+
+1.upto(10000) do |i|
+  require "c#{i}"
+end
+
+$:.pop

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]