Re: Testing Sequences for Uniqueness
- Posted by "Hawke'" <mikedeland at NETZERO.NET> Aug 24, 2000
- 491 views
methinks, mayhaps, thine benchmark hath flaw :((((( you are entering the realm of cached data since you are not comparing different sequences each run... > x=compare ({1,2,3,4,5,6},{1,2,3,4,5,6}) is the problem child line.... so my suggestion is to create a large sequence of pairs of 6 element sequences and u can step thru them while timing the equality of those pairs -----------tested code sequence data,result atom now object temp constant tries = 250000 constant dataset = {6,6,6,6,6,6} --gotta store the result or EU will possibly --throw away the equality test in an effort --to optimize dead code puts(1,"Creating empty dataset\n") data = repeat({},tries) result = repeat({},tries) puts(1,"Filling dataset with randomness\n") for i = 1 to tries do data[i] = {rand(dataset),rand(dataset)} end for puts(1,"Beginning benchmark\n") --we use the temp variable as it is --less burden on the benchmark --as we dont slice as much this way now = time() for i = 1 to tries do temp = data[i] result[i] = equal(temp[1],temp[2]) end for now = time() - now printf(1,"%d tries in %f seconds",{tries,now}) ------------end code on a pIII733 with 128mb 133mhz ram 250000 tries in 0.270000 seconds on a p200mmx with 48mb EDO ram 75000 tries in 0.220000 seconds but it took several seconds to create the dataset for each run on both machines.... i'm thinking equal() & compare() are fast nuff ;) and who said EU was slow? --Hawke' _____NetZero Free Internet Access and Email______ http://www.netzero.net/download/index.html