ruby-changes:31160
From: glass <ko1@a...>
Date: Thu, 10 Oct 2013 21:38:13 +0900 (JST)
Subject: [ruby-changes:31160] glass:r43239 (trunk): * array.c (rb_ary_compact_bang): use ary_resize_smaller().
glass 2013-10-10 21:37:58 +0900 (Thu, 10 Oct 2013) New Revision: 43239 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43239 Log: * array.c (rb_ary_compact_bang): use ary_resize_smaller(). Modified files: trunk/ChangeLog trunk/array.c Index: array.c =================================================================== --- array.c (revision 43238) +++ array.c (revision 43239) @@ -4166,10 +4166,7 @@ rb_ary_compact_bang(VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L4166 if (RARRAY_LEN(ary) == n) { return Qnil; } - ARY_SET_LEN(ary, n); - if (n * 2 < ARY_CAPA(ary) && ARY_DEFAULT_SIZE * 2 < ARY_CAPA(ary)) { - ary_resize_capa(ary, n * 2); - } + ary_resize_smaller(ary, n); return ary; } Index: ChangeLog =================================================================== --- ChangeLog (revision 43238) +++ ChangeLog (revision 43239) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Oct 10 21:36:16 2013 Masaki Matsushita <glass.saga@g...> + + * array.c (rb_ary_compact_bang): use ary_resize_smaller(). + Thu Oct 10 21:00:38 2013 Masaki Matsushita <glass.saga@g...> * st.c (st_keys): define st_keys() for performance improvement of -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/