Re: Re[2]: Eu Interpreted
- Posted by Robert Craig <rds at RapidEuphoria.com> Aug 15, 2001
- 379 views
Irv Mullins writes: > Reading line-by-line, Lua is still twice as fast as Euphoria. If you leveled the playing field, and had them both reading a character at a time, I bet Lua would read slower. For those who aren't bored with this topic yet, here's a tweaked version of get_bytes() that's about 30% faster in most cases. I've updated my copy of get.e for 2.3. global function get_bytes(integer fn, integer n) -- Return a sequence of n bytes (maximum) from an open file. -- If n > 0 and fewer than n bytes are returned, -- you've reached the end of file. sequence s integer c if n = 0 then return {} end if c = getc(fn) if c = -1 then return {} end if s = repeat(c, n) for i = 2 to n do s[i] = getc(fn) end for if s[n] != -1 then return s else -- trim eof's while s[n] = -1 do n -= 1 end while return s[1..n] end if end function Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com