Silly benchmark:

(2..7).each do |i|
    a = [10] * 10**i
    b = [20] * 10**i
    t = Time.new
    a.zip(b){|x,y|}
    puts "%9d: %8.5f" % [10**i, Time.new - t]
end

(you might also want to try a.zip(b){||} )

Results:

patched
batsman@tux-chan:/tmp/ruby$ ./ruby /tmp/bench.rb
      100:  0.00007
     1000:  0.00051
    10000:  0.00496
   100000:  0.06115
  1000000:  0.48373
 10000000:  4.71240

orig -> ruby 1.8.2 (2005-04-12) [i686-linux]
batsman@tux-chan:/tmp/ruby$ ruby /tmp/bench.rb
      100:  0.00010
     1000:  0.00077
    10000:  0.00941
   100000:  0.15001
  1000000:  4.45847
 10000000: 358.12643


Note that the difference would be larger if the environment were a bit
"heavier" (more live objects). Of course, it will be less important
for most realistic usages of #zip with non-empty blocks, but it's
nonetheless an overhead there's no reason to keep AFAIK.


Once the patch is applied, the temporary array used to hold the items
from the original arrays is allocated once; in the original code, it
would be discarded on each iteration and a new one would be allocated,
often triggering the GC...


--- array.c.orig        2005-04-18 00:11:33.000000000 +0200
+++ array.c     2005-04-18 00:22:18.000000000 +0200
@@ -2074,12 +2074,12 @@
        argv[i] = to_ary(argv[i]);
     }
     if (rb_block_given_p()) {
+        VALUE tmp = rb_ary_new2(argc+1);
+        RARRAY(tmp)->len = argc + 1;
        for (i=0; i<RARRAY(ary)->len; i++) {
-           VALUE tmp = rb_ary_new2(argc+1);
-
-           rb_ary_push(tmp, rb_ary_elt(ary, i));
+            RARRAY(tmp)->ptr[0] = RARRAY(ary)->ptr[i];
            for (j=0; j<argc; j++) {
-               rb_ary_push(tmp, rb_ary_elt(argv[j], i));
+                RARRAY(tmp)->ptr[1+j] = rb_ary_elt(argv[j], i);
            }
            rb_yield(tmp);
        }


-- 
Mauricio FernŠŌdez