越水です。今年もよろしくお願いします。 forのことを調べている途中、奇妙な現象に出会いました。下のコードなので すが、(使用されない)配列を生成するかどうかによって、uptoのスピードが桁 違いに変わります。uptoは動的にメモリを繰り返し割り当てているのでしょう か? # ruby 1.4.3 (1999-12-08) [i686-linux] # x86-Debian potato, Celeron 300A MAX = 200_000 arry = Array.new(2_000_000, 0) tmp1 = tmp2 = 0 t1 = Time.now for j in 0...MAX tmp1 + 1 end t2 = Time.now 1.upto MAX do |i| tmp2 + 1 end t3 = Time.now puts(t2 - t1) puts(t3 - t2) # 越水 # greentea / fa2.so-net.ne.jp