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

[series] Series performance

 [1/1] from: atruter::labyrinth::net::au at: 4-Jan-2004 10:17


Hi Paul,
> I'm curious what functions you ran to obtain it.
A modified version of time-it: TPS: function [note block /count ct][tot time][ recycle wait 1 if not count [ct: 1] tot: ct time: now/time/precise forever [ loop ct [do block] if 0:00:01 < (now/time/precise - time) [break] tot: tot + ct ] time: now/time/precise - time print reform [note to-integer tot / to-decimal time] ] followed by: foreach type [#[datatype! block!] #[datatype! list!] #[datatype! hash!]][ print reform ["Benchmarking" type] series: none TPS "make type! " [series: make type 1000000] insert series load %test.dat series: head series ; handles list TPS/count "first/last " [first series] 1000 TPS/count "pick/poke/at " [pick series 500000] 1000 TPS/count "find/select " [find series 1] 1000 TPS/count "find/select end" [find series 1000000] 100 TPS/count "foreach " [foreach i series []] 100 TPS/count "insert " [insert head series none] 100 TPS/count "insert tail " [insert tail series none] 1000 TPS/count "change " [change series none] 1000 TPS/count "head/tail/next " [head series] 1000 series: make type 1000000 ; avoids hash! clear bug insert series load %test.dat series: head series ; handles list! TPS/count "remove " [remove head series] 100 series: make type 1000000 ; avoids hash! clear bug insert series load %test.dat series: head series ; handles list! TPS/count "remove tail " [remove back tail series] 1000 ] QAD, but each test completes in about a second [on my hardware] with the results out by a couple of percent for loop/time management (I'm working on a more robust version that removes the loop/time component from the final result and runs each test for 10 seconds). The multi-line tests (eg. first / last) were originally separate but the results were within a couple of percent of each other that I just merged them for clarity. Not super accurate, but given the difference between something like block! insert and first, what's a few percent among friends? ;) Regards, Ashley<