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: reffy:ulrich at: 8-Sep-2002 8:53

I am thinking Rebol for the most part is very well put together internally. Interpreters are notoriously slow for some things and fast for others. In general, the avoidance of dynamic memory allocation (i.e. using C's malloc and such) is a big winner. I took the quick hack and with a half million lines, a half million mallocs occur, and, a million lines are read. Yep, I actually count them first :-) Yes, I could rewrite the little qsort.c such that it didn't traverse the lines twice, once to count. I could use 2 mallocs and one I/O effort to read the file into memory in one big chunk, and yes there would be a good improvement. But, we all know that this sort requires little intelligence to make it happen. So the gain is really not there, unless, it is to be done with multiple files (merge and sort) and done very often, in which case, writing a second version of the qsort.c might be a big winner for anyone who might want to call qsort.c from Rebol. As is often the case, the clever solution sometimes is the big winner, like realizing a parse is not needed in this particular case. Dick