[macruby-changes] [MacRuby/MacRuby] 34ebcb: ext/digest: Save a method call of reset() for a di...

noreply at github.com noreply at github.com
Fri Dec 23 03:18:18 PST 2011


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

  Commit: 34ebcb699bbcd0f245ae38d131a789cf393896c9
      https://github.com/MacRuby/MacRuby/commit/34ebcb699bbcd0f245ae38d131a789cf393896c9
  Author: Watson <watson1978 at gmail.com>
  Date:   2011-12-23 (Fri, 23 Dec 2011)

  Changed paths:
    M ext/digest/digest.c

  Log Message:
  -----------
  ext/digest: Save a method call of reset() for a disposable clone. (merged from CRuby)

https://github.com/ruby/ruby/commit/7bfdad3b


  Commit: 31449b356d10690f345a90fd03314a52a949487b
      https://github.com/MacRuby/MacRuby/commit/31449b356d10690f345a90fd03314a52a949487b
  Author: Watson <watson1978 at gmail.com>
  Date:   2011-12-23 (Fri, 23 Dec 2011)

  Changed paths:
    M ext/digest/lib/digest/hmac.rb

  Log Message:
  -----------
  ext/digest: faster code. (merged from CRuby)

https://github.com/ruby/ruby/commit/69f1e595

Test Script:
----
require 'benchmark'

Benchmark.bm(10) do |x|
  x.report "before" do
    10000.times do
      ipad = Array.new(1000).fill(0x36)
      ipad.inject('') { |s, c| s << c.chr }.freeze
    end
  end

  x.report "after" do
    10000.times do
      ipad = Array.new(1000, 0x36)
      ipad.pack('C*').freeze
    end
  end
end
----
                user     system      total        real
before     15.220000   0.320000  15.540000 ( 13.063469)
after       0.460000   0.010000   0.470000 (  0.453947)


Compare: https://github.com/MacRuby/MacRuby/compare/537dba8...31449b3


More information about the macruby-changes mailing list