1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
duerst 2014-12-02 06:30:05 +00:00
parent 062f0eddc7
commit 24f5f816ff
2 changed files with 13 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Tue Dec 2 15:30:30 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
* array.c (rb_ary_plus): in documentation, added note about
inefficiency of repeated += operations.
Tue Dec 2 07:20:21 2014 Eric Wong <e@80x24.org> Tue Dec 2 07:20:21 2014 Eric Wong <e@80x24.org>
* iseq.c (iseq_data_to_ary): keep hidden variables * iseq.c (iseq_data_to_ary): keep hidden variables

View file

@ -3525,9 +3525,17 @@ rb_ary_fill(int argc, VALUE *argv, VALUE ary)
* c #=> [ "a", "b", "c", "d", "e", "f" ] * c #=> [ "a", "b", "c", "d", "e", "f" ]
* a #=> [ "a", "b", "c" ] * 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. * See also Array#concat.
*/ */
VALUE VALUE
rb_ary_plus(VALUE x, VALUE y) rb_ary_plus(VALUE x, VALUE y)
{ {