ruby-changes:31468
From: ko1 <ko1@a...>
Date: Wed, 6 Nov 2013 09:17:19 +0900 (JST)
Subject: [ruby-changes:31468] ko1:r43547 (trunk): * benchmark/bm_vm1_gc_short_lived.rb: added.
ko1 2013-11-06 09:17:14 +0900 (Wed, 06 Nov 2013) New Revision: 43547 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43547 Log: * benchmark/bm_vm1_gc_short_lived.rb: added. These GC benchmarks do not reflect practical applications. They are only for tuning. * benchmark/bm_vm1_gc_short_with_complex_long.rb: added. * benchmark/bm_vm1_gc_short_with_long.rb: added. * benchmark/bm_vm1_gc_short_with_symbol.rb: added. * benchmark/bm_vm1_gc_wb_ary.rb: added. * benchmark/bm_vm1_gc_wb_obj.rb: added. * benchmark/bm_vm_thread_queue.rb: added. Thie benchmark is added to know how fast C verion of thread.so. Added files: trunk/benchmark/bm_vm1_gc_short_lived.rb trunk/benchmark/bm_vm1_gc_short_with_complex_long.rb trunk/benchmark/bm_vm1_gc_short_with_long.rb trunk/benchmark/bm_vm1_gc_short_with_symbol.rb trunk/benchmark/bm_vm1_gc_wb_ary.rb trunk/benchmark/bm_vm1_gc_wb_obj.rb trunk/benchmark/bm_vm_thread_queue.rb Modified files: trunk/ChangeLog Index: ChangeLog =================================================================== --- ChangeLog (revision 43546) +++ ChangeLog (revision 43547) @@ -1,3 +1,22 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Nov 6 09:14:31 2013 Koichi Sasada <ko1@a...> + + * benchmark/bm_vm1_gc_short_lived.rb: added. + These GC benchmarks do not reflect practical applications. + They are only for tuning. + + * benchmark/bm_vm1_gc_short_with_complex_long.rb: added. + + * benchmark/bm_vm1_gc_short_with_long.rb: added. + + * benchmark/bm_vm1_gc_short_with_symbol.rb: added. + + * benchmark/bm_vm1_gc_wb_ary.rb: added. + + * benchmark/bm_vm1_gc_wb_obj.rb: added. + + * benchmark/bm_vm_thread_queue.rb: added. + Thie benchmark is added to know how fast C verion of thread.so. + Wed Nov 6 09:13:32 2013 Koichi Sasada <ko1@a...> * gc.c: define RGENGC_ESTIMATE_OLDSPACE == 0 if USE_RGENGC is 0. Index: benchmark/bm_vm1_gc_wb_ary.rb =================================================================== --- benchmark/bm_vm1_gc_wb_ary.rb (revision 0) +++ benchmark/bm_vm1_gc_wb_ary.rb (revision 43547) @@ -0,0 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_vm1_gc_wb_ary.rb#L1 +long_lived = [] +GC.start +GC.start + +i = 0 +short_lived = '' +while i<30_000_000 # while loop 1 + long_lived[0] = short_lived # write barrier + i+=1 +end Index: benchmark/bm_vm1_gc_wb_obj.rb =================================================================== --- benchmark/bm_vm1_gc_wb_obj.rb (revision 0) +++ benchmark/bm_vm1_gc_wb_obj.rb (revision 43547) @@ -0,0 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_vm1_gc_wb_obj.rb#L1 +class C + attr_accessor :foo +end +long_lived = C.new +GC.start +GC.start + +i = 0 +short_lived = '' +while i<30_000_000 # while loop 1 + long_lived.foo = short_lived # write barrier + i+=1 +end Index: benchmark/bm_vm1_gc_short_with_long.rb =================================================================== --- benchmark/bm_vm1_gc_short_with_long.rb (revision 0) +++ benchmark/bm_vm1_gc_short_with_long.rb (revision 43547) @@ -0,0 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_vm1_gc_short_with_long.rb#L1 +long_lived = Array.new(1_000_000){|i| "#{i}"} +GC.start +GC.start +i = 0 +while i<30_000_000 # while loop 1 + a = '' # short-lived String + b = '' + c = '' + d = '' + e = '' + f = '' + i+=1 +end Index: benchmark/bm_vm1_gc_short_with_complex_long.rb =================================================================== --- benchmark/bm_vm1_gc_short_with_complex_long.rb (revision 0) +++ benchmark/bm_vm1_gc_short_with_complex_long.rb (revision 43547) @@ -0,0 +1,27 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_vm1_gc_short_with_complex_long.rb#L1 +def nested_hash h, n + if n == 0 + '' + else + 10.times{ + h[Object.new] = nested_hash(h, n-1) + } + end +end + +long_lived = Hash.new +nested_hash long_lived, 6 + +GC.start +GC.start + +i = 0 +while i<30_000_000 # while loop 1 + a = '' # short-lived String + b = '' + c = '' + d = '' + e = '' + f = '' + i+=1 +end + Index: benchmark/bm_vm1_gc_short_with_symbol.rb =================================================================== --- benchmark/bm_vm1_gc_short_with_symbol.rb (revision 0) +++ benchmark/bm_vm1_gc_short_with_symbol.rb (revision 43547) @@ -0,0 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_vm1_gc_short_with_symbol.rb#L1 +# make many symbols +50_000.times{|i| sym = "sym#{i}".to_sym} +GC.start +GC.start + +i = 0 +while i<30_000_000 # while loop 1 + a = '' # short-lived String + b = '' + c = '' + d = '' + e = '' + f = '' + i+=1 +end Index: benchmark/bm_vm_thread_queue.rb =================================================================== --- benchmark/bm_vm_thread_queue.rb (revision 0) +++ benchmark/bm_vm_thread_queue.rb (revision 43547) @@ -0,0 +1,18 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_vm_thread_queue.rb#L1 +require 'thread' + +n = 1_000_000 +q = Queue.new +consumer = Thread.new{ + while q.pop + # consuming + end +} + +producer = Thread.new{ + n.times{ + q.push true + } + q.push nil +} + +consumer.join Index: benchmark/bm_vm1_gc_short_lived.rb =================================================================== --- benchmark/bm_vm1_gc_short_lived.rb (revision 0) +++ benchmark/bm_vm1_gc_short_lived.rb (revision 43547) @@ -0,0 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_vm1_gc_short_lived.rb#L1 +i = 0 +while i<30_000_000 # while loop 1 + a = '' # short-lived String + b = '' + c = '' + d = '' + e = '' + f = '' + i+=1 +end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/