getc( ) and gets( ) speed
- Posted by "Euman" <euman at bellsouth.net> Dec 14, 2003
- 559 views
Hello, Can the 1st example be made any faster than the second? atom t, t1, t2, fn, lFileLen integer lWS, lWE sequence lFile, line -- Example 1 -------------------------------------------------------- lFileLen = seek(fn, -1) lFileLen = where(fn) if seek(fn, 0) then end if lFile = repeat(0, lFileLen + 1) lFile[lFileLen+1] = crlf t1 = time() for i =1 to lFileLen do lFile[i] = getc(fn) end for while lWE < lFileLen do line = lFile[lWS..lWE]) lWS = lWE + 1 lWE = lWS + 1 end if t2 = time()- t1 -------------------------------------------------------- -- Example 2 -------------------------------------------------------- t1 = time() for i = 1 to val[2] do line = gets(fn) if atom(line) then exit end if line = line[1..200] end for t2 = time()- t1 --------------------------------------------------------