ruby-changes:19339
From: kosaki <ko1@a...>
Date: Fri, 29 Apr 2011 10:44:41 +0900 (JST)
Subject: [ruby-changes:19339] Ruby:r31379 (trunk): * benchmark/bm_vm4_pipe.rb: Add two new benchmark for GVL
kosaki 2011-04-29 10:44:32 +0900 (Fri, 29 Apr 2011) New Revision: 31379 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31379 Log: * benchmark/bm_vm4_pipe.rb: Add two new benchmark for GVL performance. They was written by Koichi Sasada. * benchmark/bm_vm4_thread_pass.rb: ditto. Added files: trunk/benchmark/bm_vm4_pipe.rb trunk/benchmark/bm_vm4_thread_pass.rb Modified files: trunk/ChangeLog Index: ChangeLog =================================================================== --- ChangeLog (revision 31378) +++ ChangeLog (revision 31379) @@ -1,3 +1,9 @@ +Fri Apr 29 10:43:09 2011 KOSAKI Motohiro <kosaki.motohiro@g...> + + * benchmark/bm_vm4_pipe.rb: Add two new benchmark for GVL + performance. They was written by Koichi Sasada. + * benchmark/bm_vm4_thread_pass.rb: ditto. + Fri Apr 29 10:25:31 2011 KOSAKI Motohiro <kosaki.motohiro@g...> * vm_method.c (rb_clear_cache_by_class): Revert r29673. It made Index: benchmark/bm_vm4_thread_pass.rb =================================================================== --- benchmark/bm_vm4_thread_pass.rb (revision 0) +++ benchmark/bm_vm4_thread_pass.rb (revision 31379) @@ -0,0 +1,15 @@ +# Plenty Thtread.pass +# A performance may depend on GVL implementation. + +tmax = (ARGV.shift || 2).to_i +lmax = 2_000_000 / tmax + +(1..tmax).map{ + Thread.new{ + lmax.times{ + Thread.pass + } + } +}.each{|t| t.join} + + Index: benchmark/bm_vm4_pipe.rb =================================================================== --- benchmark/bm_vm4_pipe.rb (revision 0) +++ benchmark/bm_vm4_pipe.rb (revision 31379) @@ -0,0 +1,17 @@ +# Mesure small and plenty pipe read/write. +# A performance may depend on GVL implementation. + +lmax = 1_000_000 +r, w = IO.pipe +[Thread.new{ + lmax.times{ + w.write('a') + } + p "w:exit" +}, Thread.new{ + lmax.times{ + r.read(1) + } + p "r:exit" +}].each{|t| t.join} + -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/