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

array.c: Optimize rb_ary_and. Patch by Stefan Schüßler. [Fix GH-1938]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2018-09-16 02:42:26 +00:00
parent 4e62527c33
commit 4452e857d4

View file

@ -4236,7 +4236,7 @@ rb_ary_and(VALUE ary1, VALUE ary2)
ary2 = to_ary(ary2);
ary3 = rb_ary_new();
if (RARRAY_LEN(ary2) == 0) return ary3;
if (RARRAY_LEN(ary1) == 0 || RARRAY_LEN(ary2) == 0) return ary3;
if (RARRAY_LEN(ary1) <= SMALL_ARRAY_LEN && RARRAY_LEN(ary2) <= SMALL_ARRAY_LEN) {
for (i=0; i<RARRAY_LEN(ary1); i++) {