summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-13 14:05:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-13 14:05:56 +0000
commita72f0334472ab7f51d62d7eff6b13dc4c7f7002f (patch)
tree428dd783019d7991466f2309a3b43e361e18caeb /benchmark
parente3672626bf0de4d7b65e539caf575a5dfac7a048 (diff)
* properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/bm_vm3_clearmethodcache.rb16
-rw-r--r--benchmark/bm_vm3_thread_mutex1.rb42
-rw-r--r--benchmark/bm_vm3_thread_mutex2.rb42
-rw-r--r--benchmark/bm_vm3_thread_mutex3.rb40
4 files changed, 70 insertions, 70 deletions
diff --git a/benchmark/bm_vm3_clearmethodcache.rb b/benchmark/bm_vm3_clearmethodcache.rb
index ba45a60..a25c372 100644
--- a/benchmark/bm_vm3_clearmethodcache.rb
+++ b/benchmark/bm_vm3_clearmethodcache.rb
@@ -1,8 +1,8 @@
-i=0
-while i<200_000
- i+=1
-
- Class.new{
- def m; end
- }
-end
+i=0
+while i<200_000
+ i+=1
+
+ Class.new{
+ def m; end
+ }
+end
diff --git a/benchmark/bm_vm3_thread_mutex1.rb b/benchmark/bm_vm3_thread_mutex1.rb
index d1ba792..faf8da1 100644
--- a/benchmark/bm_vm3_thread_mutex1.rb
+++ b/benchmark/bm_vm3_thread_mutex1.rb
@@ -1,21 +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
+# 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
diff --git a/benchmark/bm_vm3_thread_mutex2.rb b/benchmark/bm_vm3_thread_mutex2.rb
index 2903845..a74e2fd 100644
--- a/benchmark/bm_vm3_thread_mutex2.rb
+++ b/benchmark/bm_vm3_thread_mutex2.rb
@@ -1,21 +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
+# 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
diff --git a/benchmark/bm_vm3_thread_mutex3.rb b/benchmark/bm_vm3_thread_mutex3.rb
index 888ae8e..ae02e20 100644
--- a/benchmark/bm_vm3_thread_mutex3.rb
+++ b/benchmark/bm_vm3_thread_mutex3.rb
@@ -1,20 +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
+# 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