aboutsummaryrefslogtreecommitdiffstats
path: root/array.c
diff options
context:
space:
mode:
authorduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-02 06:30:05 +0000
committerduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-02 06:30:05 +0000
commit24f5f816ff03621897a4c8b18393d3d027d1f02a (patch)
tree472cf50551f99a0ba32cfe8165e744b47873de33 /array.c
parent062f0eddc75495cc281dc5919e07b503e9931977 (diff)
downloadruby-24f5f816ff03621897a4c8b18393d3d027d1f02a.tar.gz
array.c (rb_ary_plus): in documentation, added note about
inefficiency of repeated += operations. [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/array.c b/array.c
index 18cde10782..2c390f9749 100644
--- a/array.c
+++ b/array.c
@@ -3525,9 +3525,17 @@ rb_ary_fill(int argc, VALUE *argv, VALUE ary)
* 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)
{