Re: Repeat efficiency

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

Thank you very much with your help, i think ill go with the integer matrix.
----- Original Message -----
From: Derek Parnell <ddparnell at bigpond.com>
Subject: Re: Repeat efficiency


>
> On Tue, 18 Feb 2003 15:50:58 -0800, <xerox_irs at lvcm.com> wrote:
>
> >
> > Hre's my test of it, maybe i should just use integers, and no floats.
> > Integer in this test is about 1000 times faster!!!!!!!!!!.
> > But its just becuase each and every one of the floats has to be
allocated
> > seperatly!!!!!. Thats 9.0 MBs for 1024x768*(32bit-pointer+64bit double
> > float). The allocate routine is called every time. Is there any way to
> > change that?
> >
> [snip]
>
> Here is code that does it three different ways. The fastest is to use a
> sequence as an integer vector.
> --------
> include machine.e
> tick_rate(1000)
> sequence clearb
> sequence zbuffer
> sequence cclearb
> sequence zzbuffer
> atom e
> atom z,p,m
>
> e = time()     clearb  = repeat(repeat(0, 1024), 768)
>
> zbuffer = clearb
> for k = 1 to 10 do
>
> for i = 1 to 768 do
>    for j = 1 to 1024 do
>       zbuffer[i][j] = floor(1500/134)
>    end for
> end for              end for
> zbuffer = clearb
>
> printf(1, "Integer Matrix %f\n", time() - e)
>
> e = time()     cclearb  = repeat(0, 1024* 768)
>
> zzbuffer = cclearb
> for k = 1 to 10 do
>
> for i = 1 to 768 * 1024 do
>       zzbuffer[i] = floor(1500/134)
> end for              end for
> zzbuffer = cclearb
>
> printf(1, "Integer Vector %f\n", time() - e)
>
> e = time()     m = 4 * 768 * 1024
> z = allocate(m)
> mem_set(z, m, 0)
>                                 for k = 1 to 10 do
>
> p = z
> for i = 1 to 768 * 1024 do
>     poke4(p,floor(1500/134))
>     p+=4
> end for
> end for
>
> mem_set(z, m, 0)
>
> printf(1, "RAM Vector %f\n", time() - e)
>
>
> --
>
> cheers,
> Derek Parnell
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu