diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-04-09 12:56:02 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-04-09 12:56:02 +0000 |
commit | 357f65d5922264767cefa84784750f757eec357d (patch) | |
tree | 4d0516cc2fcdedf2fc7cdf4e728cacd2117f3cbd | |
parent | 0c0881d517160f5095518c84d99e2429f6eb2b41 (diff) |
* array.c (rb_ary_pop): Do not reallocate too often; backported
from 1.9.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | array.c | 2 |
2 files changed, 6 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Wed Apr 9 21:54:45 2008 Akinori MUSHA <knu@iDaemons.org> + + * array.c (rb_ary_pop): Do not reallocate too often; backported + from 1.9. + Wed Apr 9 21:13:05 2008 Akinori MUSHA <knu@iDaemons.org> * array.c (rb_ary_each, rb_ary_each_index, rb_ary_reverse_each, @@ -450,7 +450,7 @@ rb_ary_pop(ary) rb_ary_modify_check(ary); if (RARRAY(ary)->len == 0) return Qnil; if (!FL_TEST(ary, ELTS_SHARED) && - RARRAY(ary)->len * 2 < RARRAY(ary)->aux.capa && + RARRAY(ary)->len * 3 < RARRAY(ary)->aux.capa && RARRAY(ary)->aux.capa > ARY_DEFAULT_SIZE) { RARRAY(ary)->aux.capa = RARRAY(ary)->len * 2; REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->aux.capa); |