"Mathieu Bouchard" <matju / sympatico.ca> wrote in message news:Pine.LNX.3.96.1010325184819.19397D-100000 / relayer... > On Mon, 26 Mar 2001, Daniel Berger wrote: > > > j,i = i,[0,i-4096].max > > > f.reverse_each {|x| print x } > > Worked like a charm. I don't know ruby well enough yet to completely > > understand this code (the codeblock & proc.call are throwing me at the > > moment) but I take it that you're reading in a max. of 4k per line. > > Is that correct? > > Well, I'm reading a max of 4k at a time; there is no limit on the length > of a line; the buffer grows bigger until the program knows that it has a > full line. Ah, I see. Thanks. > > For very, very long lines, though, the program will become slower. I think > that replacing i-4096 by i-4096-buf.length can do some good, but it also > can do some bad and i don't know how the two would balance. There are of > course a lot of other possible improvements. > > matju > By all means, add them. What would it take to propose an addition to the API? Since reading log files is a very common activity, I think it would be welcome. Thanks again. Dan