Performance regarding TMPUGUI in a simple scene

Hello!

I’m trying to improve the performance of our UI. The game runs fine in mobile, but everytime we instantiate a new panel, we see some jumps in the FPS meter. I isolated one simple panel (the shop), in an empty scene, have it disabled, and profile what happens when I enable it.

What I saw, is that TextMeshProUGUI.Rebuild() was taking up most of the frame time (34ms), which is insane. If I test the same thing with a simple UI Text component, I get <2ms.

I searched a lot in the forums & web, and couldn’t find anything regarding this, which makes me think I’m the one doing something wrong lol.

Any help?

[I attached some screenshots]

That performance hit seems high. Any chance you can submit a bug report with that scene so I can take a closer look?

Uploaded a repro case… number 1028074 @Stephan_B

1 Like

Any update on this @Stephan_B ?

I need to get to this. Thank you for the reminder.

I finally had a chance to take a look at the project you provided.

Before diving into things, thank you for providing the Repro project as this always makes it much easier to identify potential issues and to provide more accurate insight on what’s going on.

I would like to confirm that I am seeing roughly the same performance results that you are reporting.

It is important to remember that we are looking at deep profiling results which due to the profiling overhead always reflect much slower / inflated times compared to what they would be in a production build. On the other hand, deep profiling data is extremely valuable in terms of understanding the performance of various things / functions relative to each others.

In the case of the scene you provided, as we enter play mode since everything is disabled, none of the resources used by TextMesh Pro have been loaded. So on the first enabling, the settings, font asset, managers, shaders, etc. all have to be loaded / initialized which all happens on the first generation of that text object, which result in that 34ms. Now, if you were to disable / re-enable that same group of objects, the 2nd time around that 34ms for the TMP rebuild would be 0.35ms in deep profile.

Basically, the bulk of that 34ms comes from those system / resources being loaded. If the scene contained a single text object, then upon entering play mode these resources would be loaded and then upon enabling this group of object for the first time, you would get about 0.35ms.

Here is an image showing the rebuild time once these resources have been already loaded.

1 Like