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

[REBOL] Re: [series] Series performance was Re: MySQL-protocol.r

From: atruter::labyrinth::net::au at: 3-Jan-2004 17:37

Hi Tim,
> But I believe that lists and blocks are implemented > differently internally, but I'm ignorant as to how. > any comments on this?
Conceptually, a block is just a collection of values where the sequence is directly known (ie. like an "array" REBOL knows where the Nth value is). A list on the other hand ensures that each value knows where the previous and next values are (finding the Nth value in this case involves "walking" the list one value at a time). The following test attempts to highlight the strength and weakness of each series! type (keep in mind that the memory cost of list! / hash! is higher than block!). Test Data One million numbers from one through to one million in a 6.75MB file. Test Environment Intel Pentium 3.0 GHz with 1GB of RAM. Operations Per Second Operation Block! List! Hash! ================== ========= ========= ========= first / last 1,961,614 2,038,423 1,936,023 pick / poke / at 1,844,334 504 1,846,456 find / select (1) 1,546,259 1,538,385 1,399,606 find / select (2) 52 51 1,402,559 foreach 13 20 19 insert 81 1,087,684 19 insert tail 1,032,956 861,769 723,152 change 1,572,834 1,569,881 1,307,086 head / tail / next 1,883,858 1,916,338 1,816,748 remove 80 1,493,110 54 remove tail 1,127,093 1,187,992 1,115,157 (1) First value in series (2) Last value in series Regards, Ashley<