ruby-changes:19973
From: ko1 <ko1@a...>
Date: Sun, 12 Jun 2011 13:39:03 +0900 (JST)
Subject: [ruby-changes:19973] ko1:r32020 (trunk): * benchmark/bm_vm3_thread_mutex.rb: remove it.
ko1 2011-06-12 13:38:50 +0900 (Sun, 12 Jun 2011) New Revision: 32020 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32020 Log: * benchmark/bm_vm3_thread_mutex.rb: remove it. * benchmark/bm_vm3_thread_mutex[1-3].rb: added 3 benchmarks. 1: one thread with one mutex (no contention). 2: two threads with one mutex (contention). 3: 1000 threads with one mutex (huge number of contention) Abobe removed benchmark was type 3. Therefore, this commit adds type 1 and 2 benchmark. Added files: trunk/benchmark/bm_vm3_thread_mutex1.rb trunk/benchmark/bm_vm3_thread_mutex2.rb trunk/benchmark/bm_vm3_thread_mutex3.rb Removed files: trunk/benchmark/bm_vm3_thread_mutex.rb Modified files: trunk/ChangeLog Index: ChangeLog =================================================================== --- ChangeLog (revision 32019) +++ ChangeLog (revision 32020) @@ -1,3 +1,14 @@ +Sun Jun 12 13:33:52 2011 Koichi Sasada <ko1@a...> + + * benchmark/bm_vm3_thread_mutex.rb: remove it. + + * benchmark/bm_vm3_thread_mutex[1-3].rb: added 3 benchmarks. + 1: one thread with one mutex (no contention). + 2: two threads with one mutex (contention). + 3: 1000 threads with one mutex (huge number of contention) + Abobe removed benchmark was type 3. + Therefore, this commit adds type 1 and 2 benchmark. + Sun Jun 12 11:16:59 2011 Tanaka Akira <akr@f...> * io.c: use select() appropriately for sendfile(). Index: benchmark/bm_vm3_thread_mutex.rb =================================================================== --- benchmark/bm_vm3_thread_mutex.rb (revision 32019) +++ benchmark/bm_vm3_thread_mutex.rb (revision 32020) @@ -1,18 +0,0 @@ -require 'thread' -m = Mutex.new -r = 0 -max = 1000 -(1..max).map{ - Thread.new{ - i=0 - while i<max - i+=1 - m.synchronize{ - r += 1 - } - end - } -}.each{|e| - e.join -} -raise r.to_s if r != max * max Index: benchmark/bm_vm3_thread_mutex1.rb =================================================================== --- benchmark/bm_vm3_thread_mutex1.rb (revision 0) +++ benchmark/bm_vm3_thread_mutex1.rb (revision 32020) @@ -0,0 +1,21 @@ +# one thread, one mutex (no contention) + +require 'thread' +m = Mutex.new +r = 0 +max = 1000 +lmax = max * max +(1..1).map{ + Thread.new{ + i=0 + while i<lmax + i+=1 + m.synchronize{ + r += 1 + } + end + } +}.each{|e| + e.join +} +raise r.to_s if r != max * max Index: benchmark/bm_vm3_thread_mutex3.rb =================================================================== --- benchmark/bm_vm3_thread_mutex3.rb (revision 0) +++ benchmark/bm_vm3_thread_mutex3.rb (revision 32020) @@ -0,0 +1,20 @@ +# 1000 threads, one mutex + +require 'thread' +m = Mutex.new +r = 0 +max = 1000 +(1..max).map{ + Thread.new{ + i=0 + while i<max + i+=1 + m.synchronize{ + r += 1 + } + end + } +}.each{|e| + e.join +} +raise r.to_s if r != max * max Index: benchmark/bm_vm3_thread_mutex2.rb =================================================================== --- benchmark/bm_vm3_thread_mutex2.rb (revision 0) +++ benchmark/bm_vm3_thread_mutex2.rb (revision 32020) @@ -0,0 +1,21 @@ +# two threads, one mutex + +require 'thread' +m = Mutex.new +r = 0 +max = 1000 +lmax = (max * max)/2 +(1..2).map{ + Thread.new{ + i=0 + while i<lmax + i+=1 + m.synchronize{ + r += 1 + } + end + } +}.each{|e| + e.join +} +raise r.to_s if r != max * max -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/