From: Peter Hickman Date: 2002-03-08T01:34:13+09:00 Subject: Re: file reading impossibly slow? Ron Jeffries wrote: >Actually, if anything, it is slower. Very interesting ... > Odd. Here's my test. #!ruby require 'tempfile' tf = Tempfile.new("data.txt") (1..1000000).each {|i| tf.print "Here is a line of text\n" } tf.close tf.open t1 = Time.now tf.each_line {|line|} puts Time.now - t1 tf.close tf.open t1 = Time.now while(!tf.eof?) line = tf.gets end puts Time.now - t1 tf.close My times are 7.86 and 29.99 on a 500Hz Celeron using Cygwin under Win9, ruby 1.6.5, and 3.599269 and 9.272985 on my Linux, ruby 1.6.4, machine which I don't know the spec of. But the ballance remains the same. My code should have been faster.