ruby-changes:28477
From: zzak <ko1@a...>
Date: Tue, 30 Apr 2013 23:19:31 +0900 (JST)
Subject: [ruby-changes:28477] zzak:r40529 (trunk): * lib/benchmark.rb: Update Benchmark results on newer CPU
zzak 2013-04-30 23:19:20 +0900 (Tue, 30 Apr 2013) New Revision: 40529 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40529 Log: * lib/benchmark.rb: Update Benchmark results on newer CPU Modified files: trunk/ChangeLog trunk/lib/benchmark.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 40528) +++ ChangeLog (revision 40529) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Apr 30 23:18:00 2013 Zachary Scott <zachary@z...> + + * lib/benchmark.rb: Update Benchmark results on newer CPU + Tue Apr 30 12:31:40 2013 Nobuyoshi Nakada <nobu@r...> * proc.c (mproc, mlambda): use frozen core methods instead of plain Index: lib/benchmark.rb =================================================================== --- lib/benchmark.rb (revision 40528) +++ lib/benchmark.rb (revision 40529) @@ -19,15 +19,15 @@ https://github.com/ruby/ruby/blob/trunk/lib/benchmark.rb#L19 # used to execute Ruby code. # # * Measure the time to construct the string given by the expression -# <code>"a"*1_000_000</code>: +# <code>"a"*1_000_000_000</code>: # # require 'benchmark' # -# puts Benchmark.measure { "a"*1_000_000 } +# puts Benchmark.measure { "a"*1_000_000_000 } # -# On my machine (FreeBSD 3.2 on P5, 100MHz) this generates: +# On my machine (OSX 10.8.3 on i5 1.7 Ghz) this generates: # -# 1.166667 0.050000 1.216667 ( 0.571355) +# 0.350000 0.400000 0.750000 ( 0.835234) # # This report shows the user CPU time, system CPU time, the sum of # the user and system CPU times, and the elapsed real time. The unit @@ -37,7 +37,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/benchmark.rb#L37 # # require 'benchmark' # -# n = 50000 +# n = 5000000 # Benchmark.bm do |x| # x.report { for i in 1..n; a = "1"; end } # x.report { n.times do ; a = "1"; end } @@ -47,15 +47,15 @@ https://github.com/ruby/ruby/blob/trunk/lib/benchmark.rb#L47 # The result: # # user system total real -# 1.033333 0.016667 1.016667 ( 0.492106) -# 1.483333 0.000000 1.483333 ( 0.694605) -# 1.516667 0.000000 1.516667 ( 0.711077) +# 1.010000 0.000000 1.010000 ( 1.014479) +# 1.000000 0.000000 1.000000 ( 0.998261) +# 0.980000 0.000000 0.980000 ( 0.981335) # # * Continuing the previous example, put a label in each report: # # require 'benchmark' # -# n = 50000 +# n = 5000000 # Benchmark.bm(7) do |x| # x.report("for:") { for i in 1..n; a = "1"; end } # x.report("times:") { n.times do ; a = "1"; end } @@ -65,10 +65,9 @@ https://github.com/ruby/ruby/blob/trunk/lib/benchmark.rb#L65 # The result: # # user system total real -# for: 1.050000 0.000000 1.050000 ( 0.503462) -# times: 1.533333 0.016667 1.550000 ( 0.735473) -# upto: 1.500000 0.016667 1.516667 ( 0.711239) -# +# for: 1.010000 0.000000 1.010000 ( 1.015688) +# times: 1.000000 0.000000 1.000000 ( 1.003611) +# upto: 1.030000 0.000000 1.030000 ( 1.028098) # # * The times for some benchmarks depend on the order in which items # are run. These differences are due to the cost of memory @@ -88,14 +87,13 @@ https://github.com/ruby/ruby/blob/trunk/lib/benchmark.rb#L87 # The result: # # Rehearsal ----------------------------------------- -# sort! 11.928000 0.010000 11.938000 ( 12.756000) -# sort 13.048000 0.020000 13.068000 ( 13.857000) -# ------------------------------- total: 25.006000sec +# sort! 1.490000 0.010000 1.500000 ( 1.490520) +# sort 1.460000 0.000000 1.460000 ( 1.463025) +# -------------------------------- total: 2.960000sec # # user system total real -# sort! 12.959000 0.010000 12.969000 ( 13.793000) -# sort 12.007000 0.000000 12.007000 ( 12.791000) -# +# sort! 1.460000 0.000000 1.460000 ( 1.460465) +# sort 1.450000 0.010000 1.460000 ( 1.448327) # # * Report statistics of sequential experiments with unique labels, # using the #benchmark method: @@ -103,7 +101,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/benchmark.rb#L101 # require 'benchmark' # include Benchmark # we need the CAPTION and FORMAT constants # -# n = 50000 +# n = 5000000 # Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x| # tf = x.report("for:") { for i in 1..n; a = "1"; end } # tt = x.report("times:") { n.times do ; a = "1"; end } @@ -114,11 +112,11 @@ https://github.com/ruby/ruby/blob/trunk/lib/benchmark.rb#L112 # The result: # # user system total real -# for: 1.016667 0.016667 1.033333 ( 0.485749) -# times: 1.450000 0.016667 1.466667 ( 0.681367) -# upto: 1.533333 0.000000 1.533333 ( 0.722166) -# >total: 4.000000 0.033333 4.033333 ( 1.889282) -# >avg: 1.333333 0.011111 1.344444 ( 0.629761) +# for: 0.950000 0.000000 0.950000 ( 0.952039) +# times: 0.980000 0.000000 0.980000 ( 0.984938) +# upto: 0.950000 0.000000 0.950000 ( 0.946787) +# >total: 2.880000 0.000000 2.880000 ( 2.883764) +# >avg: 0.960000 0.000000 0.960000 ( 0.961255) module Benchmark @@ -145,7 +143,7 @@ module Benchmark https://github.com/ruby/ruby/blob/trunk/lib/benchmark.rb#L143 # require 'benchmark' # include Benchmark # we need the CAPTION and FORMAT constants # - # n = 50000 + # n = 5000000 # Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x| # tf = x.report("for:") { for i in 1..n; a = "1"; end } # tt = x.report("times:") { n.times do ; a = "1"; end } @@ -156,11 +154,11 @@ module Benchmark https://github.com/ruby/ruby/blob/trunk/lib/benchmark.rb#L154 # Generates: # # user system total real - # for: 1.016667 0.016667 1.033333 ( 0.485749) - # times: 1.450000 0.016667 1.466667 ( 0.681367) - # upto: 1.533333 0.000000 1.533333 ( 0.722166) - # >total: 4.000000 0.033333 4.033333 ( 1.889282) - # >avg: 1.333333 0.011111 1.344444 ( 0.629761) + # for: 0.970000 0.000000 0.970000 ( 0.970493) + # times: 0.990000 0.000000 0.990000 ( 0.989542) + # upto: 0.970000 0.000000 0.970000 ( 0.972854) + # >total: 2.930000 0.000000 2.930000 ( 2.932889) + # >avg: 0.976667 0.000000 0.976667 ( 0.977630) # def benchmark(caption = "", label_width = nil, format = nil, *labels) # :yield: report @@ -187,7 +185,7 @@ module Benchmark https://github.com/ruby/ruby/blob/trunk/lib/benchmark.rb#L185 # # require 'benchmark' # - # n = 50000 + # n = 5000000 # Benchmark.bm(7) do |x| # x.report("for:") { for i in 1..n; a = "1"; end } # x.report("times:") { n.times do ; a = "1"; end } @@ -197,9 +195,9 @@ module Benchmark https://github.com/ruby/ruby/blob/trunk/lib/benchmark.rb#L195 # Generates: # # user system total real - # for: 1.050000 0.000000 1.050000 ( 0.503462) - # times: 1.533333 0.016667 1.550000 ( 0.735473) - # upto: 1.500000 0.016667 1.516667 ( 0.711239) + # for: 0.960000 0.000000 0.960000 ( 0.957966) + # times: 0.960000 0.000000 0.960000 ( 0.960423) + # upto: 0.950000 0.000000 0.950000 ( 0.954864) # def bm(label_width = 0, *labels, &blk) # :yield: report @@ -233,13 +231,13 @@ module Benchmark https://github.com/ruby/ruby/blob/trunk/lib/benchmark.rb#L231 # Generates: # # Rehearsal ----------------------------------------- - # sort! 11.928000 0.010000 11.938000 ( 12.756000) - # sort 13.048000 0.020000 13.068000 ( 13.857000) - # ------------------------------- total: 25.006000sec + # sort! 1.440000 0.010000 1.450000 ( 1.446833) + # sort 1.440000 0.000000 1.440000 ( 1.448257) + # -------------------------------- total: 2.890000sec # # user system total real - # sort! 12.959000 0.010000 12.969000 ( 13.793000) - # sort 12.007000 0.000000 12.007000 ( 12.791000) + # sort! 1.460000 0.000000 1.460000 ( 1.458065) + # sort 1.450000 0.000000 1.450000 ( 1.455963) # # #bmbm yields a Benchmark::Job object and returns an array of # Benchmark::Tms objects. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/