warning feature in using "&" operator

new topic     » topic index » view thread      » older message » newer message

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

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu