[macruby-changes] [MacRuby/MacRuby] a3b91c: should not raise an exception, so implement vm_fas...

GitHub noreply at github.com
Tue May 15 07:05:24 PDT 2012


  Branch: refs/heads/master
  Home:   https://github.com/MacRuby/MacRuby
  Commit: a3b91c64b6fa2635f3ce51610f3f4ca9c120a8ec
      https://github.com/MacRuby/MacRuby/commit/a3b91c64b6fa2635f3ce51610f3f4ca9c120a8ec
  Author: Watson <watson1978 at gmail.com>
  Date:   2012-05-15 (Tue, 15 May 2012)

  Changed paths:
    M compiler.cpp
    M compiler.h
    M exported_symbols_list
    M kernel.c

  Log Message:
  -----------
  should not raise an exception, so implement vm_fast_mod(). fix #1471

The modulo between the Fixnum/Float is improved the performance by this patch.

* before
      user     system      total        real
  1.000000   0.000000   1.000000 (  1.000743)
  1.030000   0.000000   1.030000 (  1.030479)
  1.090000   0.000000   1.090000 (  1.097021)

* after
      user     system      total        real
  0.570000   0.000000   0.570000 (  0.577238)
  1.040000   0.000000   1.040000 (  1.031634)
  0.540000   0.000000   0.540000 (  0.539968)

Test Script:
----
require 'benchmark'

Benchmark.bm do |x|
  x.report do
    10_000_000.times do
      42 % 1
    end
  end

  x.report do
    10_000_000.times do
      42 % 1.0
    end
  end

  x.report do
    10_000_000.times do
      42.0 % 1.0
    end
  end
end





More information about the macruby-changes mailing list