1. warning feature in using "&" operator
- Posted by Lee woo seob <wslee at HHI.CO.KR> Apr 30, 1997
- 933 views
Hi everyone! It was found that there can be huge time consuming in using "&" operator. Please run the example program below and check the time for each pattern of using "&". I don't know why. Does anyone know on how to optimize speed in using "&"? -- code start here sequence a atom t integer j,k j=1 k=2 -- first pattern of using "&" a={} t=time() for i=1 to 10000 do a=a&j a=a&k -- fast end for ? time()-t -- second pattern of using "&" a={} t=time() for i=1 to 10000 do a=a&(i&j) -- huge time consumming. beacomes more severe as -- the size of "a" increase. end for ? time()-t -- code ends here
2. warning feature in using "&" operator
- Posted by Robert Craig <robert_craig at COMPUSERVE.COM> Apr 30, 1997
- 914 views
Lee woo seob writes: > for i=1 to 10000 do > a=a&j a=a&k -- fast > end for > a=a&(j&k) -- huge time consuming. becomes more severe as -- the size of "a" increases. You're right. In v1.5 (and earlier), it can be very slow to have a loop where you "grow" a very long sequence by concatenating smaller sequences onto the end of it each time in a loop. However I recently optimized this case so now it's very fast in my version. You'll see the optimization in the next release. Until then, do it the first way that you showed above. Concatenating an atom onto a sequence in a loop (or appending an atom onto a sequence) is fast, because it has been specifically optimized. Regards, Rob Craig Rapid Deployment Software