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.

Author
Message
Westmere
16
Years of Service
User Offline
Joined: 12th Mar 2010
Location: Germany
Posted: 18th Mar 2011 23:27 Edited at: 18th Mar 2011 23:31
Okay now this is VERY weird.

In my current project I recently had an unexplained drop in my fps times. Since in most cases the program doesn't have to do a lot of time consuming stuff I am usually in the range of 3000+ fps. (True, not only by screen fps() but also confirmed by FRAPS). This is mostly due to the fact that less then 5 images need to be drawn per frame if I am doing nothing and I test my codes at SYNC RATE 0 to see if anything suddenly kills my frame rates.

Recently it dropped from those 3000+ to 500-600 fps.

Since most screens don't require a lot of speed I didn't realize the drop in my framerate at first, especially since I wasn't doing anything speed relevant so I can't recall just what I did that could have affected them so badly.

So I started timing my program routines to find out what is eating up my time. I use:

and a similar construct around smaller parts of the program with t2(t). When I save the values at the end I can see how much time my program has spent in total in the main loop and how much on the routine I stopped with t2t.

After some attempts to find the evil doer I had this result:
"113277 ms wasted on T1, 108660 on T2"
108 seconds of 113 total running time consumed by a small set of code lines, there's got to be some sort of bug in these lines.

Now the first weird thing is that this particular part of the program hasn't been changed "in ages".

I actually narrowed it down to ONE command. ONE of a whole lot of commands called each frame. ONE command in 7000 lines of code, that uses 95% of the time in my main loop. ONE command I had at that place for months now. This is no joke, when I turn that command into a remark my fps jumps from 500-600 back to 3000+.

This is what's eating the time, including the timing commands:


So I'll just stick to my inital thought aka topic subject: WTH?

Any thoughts?

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Mar 2011 00:31 Edited at: 19th Mar 2011 00:32
After all of that build-up, it's an easy one

Somewhere else in your code, you have added another SET TEXT TO XXXX command (bold, italic, bolditalic, transparent, opaque), or changed the font, or changed the font size.

If you stick with an unchanging font, then DBPro does just fine. If you want to switch or change your font in some way, then use cloggy's plug-in.

Jeff Miller
21
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 19th Mar 2011 00:32
Within the forum community, it has been known for a long time that changing text parameters put the brakes on a loop. Changing them within a loop is usually done only for diagnostic purposes, seldom for a running loop. You might draw some constructive suggestions for workarounds if you describe the specific reasons you wish to change text parameters from "normal" to whatever within the loop. For example, many folks have adopted bitmap fonts for certain purposes.
Westmere
16
Years of Service
User Offline
Joined: 12th Mar 2010
Location: Germany
Posted: 20th Mar 2011 00:09 Edited at: 20th Mar 2011 00:10
Seriously?

I'd have imagined that a "set text to normal" does nothing more then changing a value used by text commands to format their output. I would NEVER EVER have believed that such a command could cause such an enormous slowdown. (I know 500-600 fps should suffice, but who knows how much of these 500-600 remain on lower-end systems. Adding to this, a single command causing a slowdown of 80 % is just too much...)

The reason I needed it there was that my program has lots of text output (dialogs, game data, descriptions, tool tips). Most of these are rarely drawn or just when the program needs to change something other then the mousepointer or highlighting a button. But since I sometimes forget to reset values after I did something with them I put two commands in to restore my text output to my programs default so I don't suddenly get half a screen of bold or italic writing, which I need to format my texts


thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 20th Mar 2011 00:28
I would recommend looking into either bitmap fonts or a plugin suchas Cloggy's d3d_func plugin. The native dbpro text commands are slow, and since the text doesn't have AA it can look very ugly and rough.

Westmere
16
Years of Service
User Offline
Joined: 12th Mar 2010
Location: Germany
Posted: 20th Mar 2011 01:16
Right, those fonts do tend to be rough and ugly ^^

Do these cloggy's funktion work similar to the regular text commands?
Where can I find it and how is it licensed?

thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 20th Mar 2011 01:34
It's free, and you can find it here:http://www.dbdepot.co.uk/d3dfunc.html

The text commands are a lot for flexible, but still not hard to use and work basically the same as regular text commands. There are examples in the download.

Westmere
16
Years of Service
User Offline
Joined: 12th Mar 2010
Location: Germany
Posted: 20th Mar 2011 01:45
I'll take a look. Maybe they won't slow my program down by 80 % ^^

Many thanks!

Login to post a reply

Server time is: 2026-07-17 13:56:25
Your offset time is: 2026-07-17 13:56:25