Fwd: glass:r37420 (trunk): * array.c (recursive_equal): performance improvement

ChangeLog
$B$H%m%0$K!$;2>H$O$"$k$s$G$9$,!$$I$&@-G=8~>e$7$?$N$+!$C;$/$^$H$a(B
$B$FD:$1$k$HNI$$$+$H;W$$$^$9!%(B

-------- Original Message --------
Subject: [ruby-changes:25363] glass:r37420 (trunk): * array.c
(recursive_equal): performance improvement.
Date: Fri, 2 Nov 2012 16:04:58 +0900 (JST)
From: glass [email protected]
Reply-To: [email protected]
To: [email protected]

glass 2012-11-02 16:04:39 +0900 (Fri, 02 Nov 2012)

New Revision: 37420

http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37420

Log:
* array.c (recursive_equal): performance improvement.
[ruby-dev:45412] [Feature #6177]

Modified files:
trunk/ChangeLog
trunk/array.c

Index: array.c

— array.c (revision 37419)
+++ array.c (revision 37420)
@@ -3270,11 +3270,27 @@
recursive_equal(VALUE ary1, VALUE ary2, int recur)
{
long i;

  • VALUE *p1, *p2;

    if (recur) return Qtrue; /* Subtle! */

  • for (i=0; i<RARRAY_LEN(ary1); i++) {
  • if (!rb_equal(rb_ary_elt(ary1, i), rb_ary_elt(ary2, i)))
  •  return Qfalse;
    
  • p1 = RARRAY_PTR(ary1);
  • p2 = RARRAY_PTR(ary2);
  • for (i = 0; i < RARRAY_LEN(ary1); i++) {
  • if (*p1 != *p2) {
  •  if (rb_equal(*p1, *p2)) {
    
  • if (RARRAY_LEN(ary1) != RARRAY_LEN(ary2))
  •    return Qfalse;
    
  • p1 = RARRAY_PTR(ary1) + i;
  • p2 = RARRAY_PTR(ary2) + i;
  •  }
    
  •  else {
    
  • return Qfalse;
  •  }
    
  • }
  • p1++;
  • p2++;
    }
    return Qtrue;
    }
    Index: ChangeLog
    ===================================================================
    — ChangeLog (revision 37419)
    +++ ChangeLog (revision 37420)
    @@ -1,3 +1,8 @@
    +Fri Nov 2 14:52:52 2012 Masaki M. [email protected]
    • array.c (recursive_equal): performance improvement.
  • [ruby-dev:45412] [Feature #6177]

Fri Nov 2 14:47:53 2012 Shugo M. [email protected]

  • string.c (sym_to_proc, sym_call): A Proc created by Symbol#to_proc

2012/11/2 SASADA Koichi [email protected]:

ChangeLog とログに,参照はあるんですが,どう性能向上したのか,短くまとめ
て頂けると良いかと思います.

ご指摘ありがとうございます。
短いですがChangeLogに説明を追加してコミットしました。
今後は簡潔な説明をつけるよう気をつけます。

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs