Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Sort by first part of line

From: carl:cybercraft at: 7-Sep-2002 12:53

On 07-Sep-02, Louis A. Turk wrote:
> Hi Everybody, > You guys are great! I've been following this thread with amazement. > I am so interested I can hardly keep my mind on other urgent > projects which unfortunately I cannot put aside right now. > Anyway, here is the data to be sorted if perchance it might be > useful for timing purposes (691KB): > http://www.pusatberita.com/test.txt
On this very slow Amiga, my leave-file-on-the-disk method took 28 minutes with your data Louis. However, the vast majority of that time was taken up with the final reading-lines-from-disk and writing-lines-back-to-disk loop. Index creation took 75 seconds and sorting 31 seconds. I assume the saving of the data could be sped up by reading in blocks of lines (say 1000) before writing them out, which would stop the switching from read to write for each line. Others with more experience of REBOL's random-access of files probably know a more sensible method for doing this than I used... And a question for those others: Does... file: open/lines file-name load the whole file into memory anyway? As I didn't notice any disk-reading while the index was being built. If so, it sort of makes the whole point of attempting to work with the file on disk a bit of a waste of effort. PS. And it's quite fun and kind of hypnotic to scroll fast through Louis's data after it's been sorted. Especially after you get past the first few numbered lines. (: -- Carl Read