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.

Newcomers DBPro Corner / My function is slow, I can kind of see why, but need help.

Author
Message
EsteemDE
19
Years of Service
User Offline
Joined: 5th Aug 2005
Location:
Posted: 20th Apr 2006 02:03
I made a function to give more control over the way I draw a line of text. When I used it once my FPS dropped from 1000+ to around 90-100. I then added 2 more function calls in the loop and it went down to 30-35fps.

Here is the function code and my loop (this is the whole program... I was just testing)



Does anyone know a way to do this but keep the speed up?
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 20th Apr 2006 02:17
DBpro is not very efficient at constantly changing text fonts as it forcibly reloads tat font every time. Much better to only change font if different from current font, or make things simpler. If all text is going to be Arial, set it once outside the loop. Never try and swap between multiple fonts in your main loop.

There is talk that maybe a future update may fix this shortcoming.

Boo!
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 20th Apr 2006 02:28
2D commands in DBC/P are notoriously slow - in particular any of the associated text command, so you will inevitably get some slowdown.

You can help a bit by using Syncs:



With the above Syncs added, I was getting a steady 45 fps with 6 function calls.

TDK_Man

EsteemDE
19
Years of Service
User Offline
Joined: 5th Aug 2005
Location:
Posted: 20th Apr 2006 02:43 Edited at: 20th Apr 2006 02:46
Thanks spooky. That helped me figure out the speed issue. It took a few more variables and IF statements but now my function is just as fast as using the "Text" command by iteself.

If anyone wants the function here it is:

Login to post a reply

Server time is: 2024-09-24 21:31:55
Your offset time is: 2024-09-24 21:31:55