[macruby-changes] [MacRuby/MacRuby] 94a97d: Optimize Array.new with block.

noreply at github.com noreply at github.com
Sat Jun 18 07:11:19 PDT 2011


  Branch: refs/heads/master
  Home:   https://github.com/MacRuby/MacRuby

  Commit: 94a97d32fd16e0b88c7271d8e410f98b48d34ce9
      https://github.com/MacRuby/MacRuby/commit/94a97d32fd16e0b88c7271d8e410f98b48d34ce9
  Author: Watson <watson1978 at gmail.com>
  Date:   2011-06-18 (Sat, 18 Jun 2011)

  Changed paths:
    M array.c

  Log Message:
  -----------
  Optimize Array.new with block.

* before
                   user     system      total        real
without block  0.280000   0.060000   0.340000 (  0.185518)
with block     0.680000   0.120000   0.800000 (  0.517797)

* after
                   user     system      total        real
without block  0.290000   0.060000   0.350000 (  0.186769)
with block     0.490000   0.040000   0.530000 (  0.394732)

{{{
require 'benchmark'

Benchmark.bm(13) do |x|
  x.report "without block" do
    1000.times do
      Array.new(10000)
    end
  end

  x.report "with block" do
    1000.times do
      Array.new(10000) {|i| }
    end
  end
end
}}}




More information about the macruby-changes mailing list