Re: Repeat efficiency

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

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?

--the code starts
include machine.e
tick_rate(1000)
sequence clearb
sequence zbuffer
atom e
e = time()     clearb  = repeat(repeat(0.0, 1024), 768)
zbuffer = clearb
for i = 1 to 768 do
   for j = 1 to 1024 do
      zbuffer[i][j] = 1+1 -- computing a value runtime makes it store
differently
   end for
end for
zbuffer = clearb
? time() - e

e = time()     clearb  = repeat(repeat(0.0, 1024), 768)
zbuffer = clearb
for i = 1 to 768 do
   for j = 1 to 1024 do
      zbuffer[i][j] = 1.1+1.1 -- computing a float makes it allocate room
for it everytime!, would be faster with large cache
--of pre-allocated memory!!!!!
   end for
end for
zbuffer = clearb
? time() - e


--results
0.1289803592 seconds
108.2445168   seconds

----- Original Message -----
From: Derek Parnell <ddparnell at bigpond.com>
To: EUforum <EUforum at topica.com>
Sent: Tuesday, February 18, 2003 3:11 PM
Subject: Re: Repeat efficiency


>
> On Tue, 18 Feb 2003 12:30:21 -0800, <xerox_irs at lvcm.com> wrote:
>
> >
> > I'm making a large z-buffer for a 3d program is dos.
> >
> > "zbuffer=repeat(repeat(0,1024),768)" --works fast but when I
> >
> > "zbuffer[y][x]=something"--it slows down really bad, probably because it
> > allocates a new double every time i do that
> >
> > I've tried
> >
> > "zbuffer=repeat(repeat(0,1024),768)+0.0" --takes a minute but makes
> >
> > "zbuffer[y][x]=something" alot faster like multiple times faster
> >
> > but the problem is that zbuffer must clear every frame.
> >
> > so something like this still wouldn't work
> >
> > constant clear_buffer=repeat(repeat(0,1024),768)+0.0
> >
> > while 1 do
> > zbuffer=clear_buffer        --it would only be fast once !!!!! then make
> > the "zbuffer[y][x]=something" slow aagain
> > --do 3d stuff here
> > end while
> >
> > can you make the allocating cache bigger to whre if I allocate 8 megs
> > then free then it will not need to call the allocateing process for
every
> > "zbuffer[y][x]=something", it would just take up the a part 8meg.
> > So euphoria would not give the 8meg back so quitly after allocateing it
> > so i could use it quickly.
> >
> > How should I make the zbuffer ????????
> >
> > the only possibility is just to inverse the points every time, which
> > would slow it down alot
> >
> > zbuffer=repeat(repeat(0,1024),768)+0.0
> >
> > while 1 do
> > zbuffer=-zbuffer
> > --do 3d stuff here
> > zbuffer=-zbuffer
> > --do inverse 3d stuff here
> > end while
> >
> > P.S. I want to keep it all in euphoria, and not use any asm so it can be
> > as readable and portable as possible.
>
> The following code takes 0.11 seconds on my Windows 2000 , Intel P3,
550MHz
> -----
> sequence clearb
> sequence zbuffer
> atom e
> e = time()     clearb  = repeat(repeat(0.0, 1024), 768)
> zbuffer = clearb
> for i = 1 to 768 do
>    for j = 1 to 1024 do
>       zbuffer[i][j] = 2.34 -- any value
>    end for
> end for
> zbuffer = clearb
> ? 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