Issue #6177 has been updated by nobu (Nobuyoshi Nakada).


Glass_saga (Masaki Matsushita) wrote:
> patch??????????rb_equal()??????????????????????RARRAY_LEN????????????
> p1, p2???????????????????????????????????????????????????????????????????
> rb_ary_elt()???使????簡????????????????????以???????????????????????????????????

??????大?????????rb_ary_elt()????????????????????????????????????????????
????

> >???????????&&??????||??????????????????????
> 
> ??????????????????&&???正????????????
> ????????????????VALUE??????????????????????#==?????????????????????????????????????????????????Qfalse??????????????

?????????????

> ???????patch???添????????????

i != 0 ????常?? (p1 != RARRAY_PTR(ary1)) ??????????????????????????

----------------------------------------
Feature #6177: array.c???rb_ary_equal()??????????
https://bugs.ruby-lang.org/issues/6177#change-24974

Author: Glass_saga (Masaki Matsushita)
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 2.0.0


?????????????VALUE??????????????????????????????rb_equal()????????????????????????rb_ary_equal()?????????????試??????????
次??????????????????????????????以???????????????????????????????

require 'benchmark'

A = Array.new(100_0000){|n| n }
B = Array.new(1_0000){|n| n.to_s }
C = Array.new(1_0000){|n| n.to_s }

Benchmark.bm do |x|
  x.report do
    A == A.dup
  end

  x.report do
    B == C
  end
end

trunk(r35092):
       user     system      total        real
   0.010000   0.000000   0.010000 (  0.011711)
   0.010000   0.000000   0.010000 (  0.002169)

proposal:
       user     system      total        real
   0.000000   0.000000   0.000000 (  0.002257)
   0.000000   0.000000   0.000000 (  0.002307)

Fixnum??????????????????Array?????????????5???????????????????????????
?????rb_equal()???????????????????????????????????????????????????????????

patch???添????????????


-- 
http://bugs.ruby-lang.org/