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

Gotcha!

 [1/2] from: hallvard::ystad::oops-as::no at: 18-Mar-2004 23:06


Hi list Ashley Truter showed us in january, I think, that list! is significantly faster than hash! and block! with 'insert and 'remove operations. So for building up a huge hash! that I need in an application, I use a list! that I 'to-hash afterwards. But watch out! 'Insert on a list! sets the list index to the position after the insert! So after insterting all my values in a 'foreach, I need to remember 'head: facts: to-hash HEAD facts It took a while to figure this out. I know I have seen this as a comment from someone in the docs somewhere sometime, but don't remember... Just a warning. And a sigh. HY

 [2/2] from: atruter:labyrinth:au at: 19-Mar-2004 10:05


> It took a while to figure this out. I know I have seen this as a comment > from someone in the docs somewhere sometime, but don't remember...
http://www.rebol.com/docs/core23/rebolcore-16.html#section-2.8 I can't recall whether I mentioned this at the time, but I have discovered that "formating" and 'poking a block is significantly faster than the typical insert loop. i: 10000000 a: make block! i repeat c i [insert tail a c] b: make block! i insert/dup b none i repeat c i [poke b c c] On my PC the times are 5.64s and 3.67s respectively. Regards, Ashley