[前][次][番号順一覧][スレッド一覧]

ruby-changes:36601

From: duerst <ko1@a...>
Date: Tue, 2 Dec 2014 15:30:15 +0900 (JST)
Subject: [ruby-changes:36601] duerst:r48682 (trunk): array.c (rb_ary_plus): in documentation, added note about

duerst	2014-12-02 15:30:05 +0900 (Tue, 02 Dec 2014)

  New Revision: 48682

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

  Log:
    array.c (rb_ary_plus): in documentation, added note about
      inefficiency of repeated += operations. [ci skip]

  Modified files:
    trunk/ChangeLog
    trunk/array.c
Index: array.c
===================================================================
--- array.c	(revision 48681)
+++ array.c	(revision 48682)
@@ -3525,9 +3525,17 @@ rb_ary_fill(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/array.c#L3525
  *     c                         #=> [ "a", "b", "c", "d", "e", "f" ]
  *     a                         #=> [ "a", "b", "c" ]
  *
+ *  Note that
+ *     x += y
+ *  is the same as
+ *     x = x + y
+ *  This means that it produces a new array. As a consequence,
+ *  repeated use of += on arrays can be quite inefficient.
+ *
  *  See also Array#concat.
  */
 
+
 VALUE
 rb_ary_plus(VALUE x, VALUE y)
 {
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48681)
+++ ChangeLog	(revision 48682)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Dec  2 15:30:30 2014  Martin Duerst  <duerst@i...>
+
+	* array.c (rb_ary_plus): in documentation, added note about
+	  inefficiency of repeated += operations.
+
 Tue Dec  2 07:20:21 2014  Eric Wong  <e@8...>
 
 	* iseq.c (iseq_data_to_ary): keep hidden variables

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]