Label performance

Started by billarhos, 25 September 2015, 11:01:14



I realize that if i use sf::Text instead of tgui::Label::Ptr, i gain more frame performance.
For example in release mode and 21 Texts painting out, i gain about 1000 frames. I use no frame limit.
In this example  i used DejaVuSans.ttf , regular style and 15 for font size.

both result appearance are the same.



I don't see a question. Is part of the post missing, since you talk about "this example"?


When i say this example, i mean my code example (just 6 edit boxes and 21 label texts).

I did not make a question yes - it is more pointing out this situation.
Have you ever noticed that frame delay?
Seem right for me to tell about my detection findings.



I'm not sure what "frame delay" you are talking about.
I didn't really understand what you are saying in your first post. You talk about 1000 fps, but you don't compare it to anything. So I can't tell if it is a good or a bad thing.

Perhaps you should try to reformulate what you were saying but with more sentences and a bit more explanation, maybe I'll understand what you are talking about then.


I do not talk about general 1000 frames but that i gain 1000 frames.

Let me rephrase.

if i use "sf::Text labels[21]"

instead of "tgui::Label::Ptr labels[21]"

my app has 1000 frames(FPS) more. (3500fps vs 2500fps).

So, what i say is that sf::Text is faster than tgui::Label.

is it clear now.



Ok, I understand now.
The most important part is this: "3500fps vs 2500fps". FPS scales non-linearly. This means that having such big difference means nothing. If your fps was 60 then the same change might have changed it to 59.

To really see how much difference there is you would have to create so many text objects that you get about 60 or 30 fps and then change them to Labels. And then instead of measuring fps just measure the time per frame (which is not reliable while getting thousands of fps).

A certain performance loss is to be expected. Label is so much more than a simple sf::Text, although just drawing it is optimized so that there is practically no difference. The only thing that Label::draw does more than Text::draw is executing a few if statements to skip parts of the drawing, it will only takes a lot more time when you e.g. set a background color or disable auto-scaling. This part can't be optimized much more.

There are also other parts in the gui where you might loose some performance, e.g. every frame the elapsed time will be updated and all widgets will receive an event for this in case they need to do something. Things like these can also take some time. The goal of the gui is to be simple, not to be the most performant one (although functions like the draw function which are executed a lot are usually more optimized than e.g. loading widgets).

To summarize: Less performance is expected but the big fps drop says nothing about how big the performance difference really is.



At the end sure i will set my app to 60 frames. Is that right now i make some tests.
I understand also about non-linear scaling of fps.

Thanks for the detailed explanation.