Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Improve your DB PRO Speed

Author
Message
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 10th Oct 2002 17:57
Seeing as all the loops except for For/Next are slow.

Could anyone with a decent sized project in the works replace their main

Do
`game code here
sync
Loop

code with something like this:

for x=1 to 2
x=1
`game code here
sync
next x

and test the speed of your program? Using FPS value or timers to judge potential speed increase using FOR NEXT for your Main Loop instead of DO LOOP.

Zep--
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 10th Oct 2002 17:58
In case you are wondering, my framerate DOUBLES using FOR/NEXT instead of DO/LOOP for my Main Loop.

Zep--

Hubdule
21
Years of Service
User Offline
Joined: 3rd Sep 2002
Location: Gundelsheim
Posted: 10th Oct 2002 18:00
You can even enhance your speed using

fastsync instead of

sync

Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 10th Oct 2002 18:05
fastsync doesn't help all that much, maybe a 1-2 FPS improvement.

While using for/next for my main loop makes my FPS go from 20 to 40!

Zep--

Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 10th Oct 2002 18:09
code to show how slow the other loops versions are compared to a FOR/NEXT loop



Zep--

Dazzag
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Cyprus
Posted: 10th Oct 2002 18:57
Strange, DB was similar when it came to all it's loops (tested ages ago). Even a "fake" goto loop was only very slightly faster.

Cheers

I am 99% probably lying in bed right now... so don't blame me for crappy typing
deadlyduck
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United Kingdom
Posted: 10th Oct 2002 23:17
Wow, I had to increase the loops to 1000000 as my machine's a bit of a beast and was getting times of 0

here are my results

For Next 16
Do Loop 94
Repeat Until 109
While Wend 94

quite a difference there, It's For Next loops for my mains from now on
deadlyduck
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United Kingdom
Posted: 10th Oct 2002 23:20
Even changing the for loop to this



dosn't make much difference in the runtime...
and thats an extra command!
Milamber
21
Years of Service
User Offline
Joined: 27th Sep 2002
Location: Australia
Posted: 11th Oct 2002 18:31
Whoa. . .
For Next 1
Do Loop 69
Repeat Until 70
While Endwhile 71

Multiplied the length of the loops by 10
For Next 14
Do Loop 816
Repeat Until 761
While Endwhile 783

Is this some kind of bug???
Do Loop should essentially be a Goto and matched label (replace Do with lbl1: and Loop with Goto lbl1) and it STILL runs that slow? The For Next loop at least has to make a check against the value each loop, so you would expect it to be slower, not 70 times faster!

System Specs: AMD Athlon 1700+ XP, GA-7VRX motherboard, 128MB DDR RAM, GeForce2 MX400 64MB VRAM
Milamber
21
Years of Service
User Offline
Joined: 27th Sep 2002
Location: Australia
Posted: 11th Oct 2002 18:45
If the DBPro team can't think of any way to fix this, they could try replacing the other loops with the code for the For Next loop, taking out the increment, and patching in the check you specify somehow (eg "FOR x=0 to 1:IF condition THEN x=1:next x" without the autoincrement would work fine).

System Specs: AMD Athlon 1700+ XP, GA-7VRX motherboard, 128MB DDR RAM, GeForce2 MX400 64MB VRAM
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 11th Oct 2002 18:47
Milamber,

Close, but do loop also provides an OUT(goto does not), ie, EXIT. Still, should not be that slow as you can code an out to the for next loop with EXIT with no slowdown.

Zep--

Milamber
21
Years of Service
User Offline
Joined: 27th Sep 2002
Location: Australia
Posted: 11th Oct 2002 21:19
All that involoves is formalising that that area is in fact a loop, ending at the LOOP command, so EXIT is just a GOTO command again. (replace LOOP with a GOTO command and then a label)

System Specs: AMD Athlon 1700+ XP, GA-7VRX motherboard, 128MB DDR RAM, GeForce2 MX400 64MB VRAM

Login to post a reply

Server time is: 2024-03-19 02:06:42
Your offset time is: 2024-03-19 02:06:42