ruby-changes:29421
From: ko1 <ko1@a...>
Date: Thu, 20 Jun 2013 15:18:22 +0900 (JST)
Subject: [ruby-changes:29421] ko1:r41473 (trunk): * benchmark/gc: create a directory to store GC related benchmark.
ko1 2013-06-20 15:18:09 +0900 (Thu, 20 Jun 2013) New Revision: 41473 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41473 Log: * benchmark/gc: create a directory to store GC related benchmark. * benchmark/gc/gcbench.rb: moved from tool/gcbench.rb. * benchmark/gc/hash(1|2).rb: ditto. * benchmark/gc/rdoc.rb: ditto. * benchmark/gc/null.rb: added. * common.mk: fix rule. Added directories: trunk/benchmark/gc/ Added files: trunk/benchmark/gc/gcbench.rb trunk/benchmark/gc/hash1.rb trunk/benchmark/gc/hash2.rb trunk/benchmark/gc/null.rb trunk/benchmark/gc/rdoc.rb Removed files: trunk/tool/gcbench.rb trunk/tool/hashbench1.rb trunk/tool/hashbench2.rb trunk/tool/rdocbench.rb Modified files: trunk/ChangeLog trunk/common.mk Index: ChangeLog =================================================================== --- ChangeLog (revision 41472) +++ ChangeLog (revision 41473) @@ -1,3 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Jun 20 15:14:00 2013 Koichi Sasada <ko1@a...> + + * benchmark/gc: create a directory to store GC related benchmark. + + * benchmark/gc/gcbench.rb: moved from tool/gcbench.rb. + + * benchmark/gc/hash(1|2).rb: ditto. + + * benchmark/gc/rdoc.rb: ditto. + + * benchmark/gc/null.rb: added. + + * common.mk: fix rule. + Thu Jun 20 14:09:54 2013 Koichi Sasada <ko1@a...> * tool/hashbench1.rb: fix paramter too. Increase temporary objects. Index: common.mk =================================================================== --- common.mk (revision 41472) +++ common.mk (revision 41473) @@ -426,19 +426,13 @@ rdoc-coverage: PHONY main https://github.com/ruby/ruby/blob/trunk/common.mk#L426 RDOCBENCHOUT=/tmp/rdocbench -gcbench-rdoc: PHONY - @echo Benchmark with Generating RDoc documentation - $(Q) $(XRUBY) "$(srcdir)/tool/gcbench.rb" "$(srcdir)/tool/rdocbench.rb" --root "$(srcdir)" --page-dir "$(srcdir)/doc" --encoding=UTF-8 --no-force-update --all --ri --debug $(RDOCFLAGS) --quiet "$(srcdir)" +GCBENCH_ITEM=null -gcbench-hash1: PHONY - @echo "Benchmark with hashbench1 (many temporal objects / obj count intensive)" - $(Q) $(XRUBY) "$(srcdir)/tool/gcbench.rb" "$(srcdir)/tool/hashbench1.rb" - -gcbench-hash2: PHONY - @echo "Benchmark with hashbench2 (increasing hash size / malloc intensive)" - $(Q) $(XRUBY) "$(srcdir)/tool/gcbench.rb" "$(srcdir)/tool/hashbench2.rb" +gcbench: PHONY + $(Q) $(XRUBY) "$(srcdir)/benchmark/gc/gcbench.rb" $(GCBENCH_ITEM) -gcbench-hash: PHONY gcbench-hash1 gcbench-hash2 +gcbench-rdoc: PHONY + $(Q) $(XRUBY) "$(srcdir)/benchmark/gc/gcbench.rb" rdoc nodoc: PHONY Index: benchmark/gc/hash1.rb =================================================================== --- benchmark/gc/hash1.rb (revision 0) +++ benchmark/gc/hash1.rb (revision 41473) @@ -0,0 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/gc/hash1.rb#L1 +value = 0.01 +h = {} +n = 50_000 + +1.upto(n){|i| + h["%020d" % i] = "v-#{i}" +} + +(n * 1_000).times{ + '' +} Property changes on: benchmark/gc/hash1.rb ___________________________________________________________________ Added: svn:eol-style + LF Index: benchmark/gc/hash2.rb =================================================================== --- benchmark/gc/hash2.rb (revision 0) +++ benchmark/gc/hash2.rb (revision 41473) @@ -0,0 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/gc/hash2.rb#L1 +value = 0.01 +h = {} +n = 4*(10**6) + +1.upto(n){|i| + h["%020d" % i] = value * i +} Property changes on: benchmark/gc/hash2.rb ___________________________________________________________________ Added: svn:eol-style + LF Index: benchmark/gc/rdoc.rb =================================================================== --- benchmark/gc/rdoc.rb (revision 0) +++ benchmark/gc/rdoc.rb (revision 41473) @@ -0,0 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/gc/rdoc.rb#L1 +require 'rdoc/rdoc' +require 'tmpdir' + +srcdir = File.expand_path('../..', __dir__) + +Dir.mktmpdir('rdocbench-'){|d| + dir = File.join(d, 'rdocbench') + args = %W(--root #{srcdir} --page-dir #{srcdir}/doc --encoding=UTF-8 --no-force-update --all --ri --debug --quiet #{srcdir}) + args << '--op' << dir + + r = RDoc::RDoc.new + r.document args +} Property changes on: benchmark/gc/rdoc.rb ___________________________________________________________________ Added: svn:eol-style + LF Index: benchmark/gc/gcbench.rb =================================================================== --- benchmark/gc/gcbench.rb (revision 0) +++ benchmark/gc/gcbench.rb (revision 41473) @@ -0,0 +1,27 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/gc/gcbench.rb#L1 + +require 'benchmark' +require 'pp' + +script = File.join(__dir__, ARGV.shift) +script += '.rb' unless FileTest.exist?(script) +raise "#{script} not found" unless FileTest.exist?(script) + +puts "Script: #{script}" + +GC::Profiler.enable +tms = Benchmark.measure{|x| + load script +} +GC::Profiler.report +pp GC.stat + +gc_time = GC::Profiler.total_time + +puts +puts script +puts Benchmark::CAPTION +puts tms +puts "GC total time (sec): #{gc_time}" +puts +puts "Summary #{RUBY_DESCRIPTION}\t#{tms.real}\t#{gc_time}\t#{GC.count}" +puts " (real time in sec, GC time in sec, GC count)" Property changes on: benchmark/gc/gcbench.rb ___________________________________________________________________ Added: svn:eol-style + LF Index: benchmark/gc/null.rb =================================================================== --- benchmark/gc/null.rb (revision 0) +++ benchmark/gc/null.rb (revision 41473) @@ -0,0 +1 @@ +# null Index: tool/rdocbench.rb =================================================================== --- tool/rdocbench.rb (revision 41472) +++ tool/rdocbench.rb (revision 41473) @@ -1,11 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/tool/rdocbench.rb#L0 -require 'rdoc/rdoc' -require 'tmpdir' - -Dir.mktmpdir('rdocbench-'){|d| - dir = File.join(d, 'rdocbench') - args = ARGV.dup - args << '--op' << dir - - r = RDoc::RDoc.new - r.document args -} Index: tool/hashbench1.rb =================================================================== --- tool/hashbench1.rb (revision 41472) +++ tool/hashbench1.rb (revision 41473) @@ -1,11 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/tool/hashbench1.rb#L0 -value = 0.01 -h = {} -n = 50_000 - -1.upto(n){|i| - h["%020d" % i] = "v-#{i}" -} - -(n * 1_000).times{ - '' -} Index: tool/gcbench.rb =================================================================== --- tool/gcbench.rb (revision 41472) +++ tool/gcbench.rb (revision 41473) @@ -1,22 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/tool/gcbench.rb#L0 - -require 'benchmark' -require 'pp' - -script = ARGV.shift || raise - -GC::Profiler.enable -tms = Benchmark.measure{|x| - load script -} -GC::Profiler.report -pp GC.stat - -gc_time = GC::Profiler.total_time - -puts -puts Benchmark::CAPTION -puts tms -puts "GC total time (sec): #{gc_time}" -puts -puts "Summary #{RUBY_DESCRIPTION}\t#{tms.real}\t#{gc_time}\t#{GC.count}" -puts " (real time in sec, GC time in sec, GC count)" Index: tool/hashbench2.rb =================================================================== --- tool/hashbench2.rb (revision 41472) +++ tool/hashbench2.rb (revision 41473) @@ -1,7 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/tool/hashbench2.rb#L0 -value = 0.01 -h = {} -n = 4*(10**6) - -1.upto(n){|i| - h["%020d" % i] = value * i -} -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/