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: 6-Sep-2002 23:23

On 06-Sep-02, [SunandaDH--aol--com] wrote:
> But when it comes to working out what is actually faster none of us > has much of an internal model of how Rebol goes about doing things. > All we can do is speculate and experiment.
I've just had a play with some randomly generated data, and I suspect with my method the loading of the data might take a good amount of time compared to the actual sorting, and in that case using a list instead of a block would help to speed the loading up. Lists are slightly different to blocks though, so you should read up on them before just assuming they're like a block. For instance, you might load a block like this...
>> blk: []
== []
>> for n 1 9 1 [append blk n]
== [1 2 3 4 5 6 7 8 9] whereas with a list, insert could be used as it moves the index with each insert...
>> lst: to-list []
== make list! []
>> for n 1 9 1 [insert lst n]
== make list! []
>> head lst
== make list! [1 2 3 4 5 6 7 8 9] and that would be faster than using append on a list. -- Carl Read