Repeat efficiency
- Posted by xerox_irs at lvcm.com Feb 18, 2003
- 472 views
This is a multi-part message in MIME format. ------=_NextPart_000_0012_01C2D749.80F63A00 charset="iso-8859-1" I'm making a large z-buffer for a 3d program is dos. "zbuffer=3Drepeat(repeat(0,1024),768)" --works fast but when I "zbuffer[y][x]=3Dsomething"--it slows down really bad, probably because = it allocates a new double every time i do that I've tried "zbuffer=3Drepeat(repeat(0,1024),768)+0.0" --takes a minute but makes "zbuffer[y][x]=3Dsomething" 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=3Drepeat(repeat(0,1024),768)+0.0 while 1 do zbuffer=3Dclear_buffer --it would only be fast once !!!!! = then make the "zbuffer[y][x]=3Dsomething" 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]=3Dsomething", 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=3Drepeat(repeat(0,1024),768)+0.0 while 1 do zbuffer=3D-zbuffer --do 3d stuff here zbuffer=3D-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. ------=_NextPart_000_0012_01C2D749.80F63A00 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 5.50.4807.2300" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>I'm making a large z-buffer for a 3d = program is=20 dos.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>"zbuffer=3Drepeat(repeat(0,1024),768)" = --works fast=20 but when I</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>"zbuffer[y][x]=3Dsomething"--it slows = down really=20 bad, probably because it allocates a new double every time i do=20 that</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>I've tried</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV> <DIV><FONT face=3DArial = size=3D2>"zbuffer=3Drepeat(repeat(0,1024),768)+0.0" --takes a=20 minute but makes</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>"zbuffer[y][x]=3Dsomething" alot faster = like multiple=20 times faster</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>but the problem is that zbuffer must = clear every=20 frame.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>so something like this still wouldn't=20 work</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>constant=20 clear_buffer=3Drepeat(repeat(0,1024),768)+0.0</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>while 1 do</FONT></DIV> <DIV><FONT face=3DArial size=3D2> =20 zbuffer=3Dclear_buffer --it = would only=20 be fast once !!!!! then make the "zbuffer[y][x]=3Dsomething" slow=20 aagain</FONT></DIV> <DIV><FONT face=3DArial = size=3D2> --do 3d=20 stuff here</FONT></DIV> <DIV><FONT face=3DArial size=3D2>end while</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>can you make the allocating cache = bigger to whre if=20 I allocate 8 megs then free then it will not need to call the = allocateing=20 process for every "zbuffer[y][x]=3Dsomething", it would just take up the = a part=20 8meg.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>So euphoria would not give the 8meg = back so quitly=20 after allocateing it so i could use it quickly.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>How should I make the zbuffer = ????????</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>the only possibility is just to inverse = the points=20 every time, which would slow it down alot</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> <DIV><FONT face=3DArial = size=3D2>zbuffer=3Drepeat(repeat(0,1024),768)+0.0</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>while 1 do</FONT></DIV> <DIV><FONT face=3DArial size=3D2> =20 zbuffer=3D-zbuffer</FONT></DIV> <DIV><FONT face=3DArial = size=3D2> --do 3d=20 stuff here</FONT></DIV> <DIV><FONT face=3DArial size=3D2> <DIV><FONT face=3DArial size=3D2> =20 zbuffer=3D-zbuffer</FONT></DIV> <DIV><FONT face=3DArial = size=3D2> --do=20 inverse 3d stuff here</FONT></DIV>end while</FONT></DIV> <DIV> </DIV></FONT></DIV> <DIV><FONT face=3DArial size=3D2>P.S. I want to keep it all in euphoria, = and not use=20 any asm so it can be as readable and portable as possible.</FONT></DIV> ------=_NextPart_000_0012_01C2D749.80F63A00--