Re: append speed

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

Nice, helpful response R.W.D.; however, I think your code needs to reset t0
right after u = {}, & probably should use exactly the same data in each
sequence, too?  Looks like repeat is about 10 times faster than append to
fill a sequence.

Dan Moyer


-----Original Message-----
From: R. W. D. <filexfer3 at JUNO.COM>
To: EUPHORIA at LISTSERV.MUOHIO.EDU <EUPHORIA at LISTSERV.MUOHIO.EDU>
Date: Friday, May 19, 2000 4:36 PM
Subject: Re: append speed


>>is append() function slow?
>>is repeat() function much faster?
>
>atom t,t0, total
>sequence s, u
>
>total = 1000000
>
>s = {}
>
>t0 = time()
>for i=1 to total do
>    s=append(s,"Hand-crafted from only the finest ASCII.\n")
>end for
>t = time()-t0
>printf(1,"Time: %3.2f\n",{t})
>
>u = {}
>u=repeat("Microwave hint: Make hole in turtle's shell first.\n",total)
>t=time()-t0
>printf(1,"Time: %3.2f\n",{t})

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

Search



Quick Links

User menu

Not signed in.

Misc Menu