Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

TextMesh Pro Performance considerations

Discussion in 'UGUI & TextMesh Pro' started by PaulUsul, Sep 19, 2017.

  1. PaulUsul

    PaulUsul

    Joined:
    Nov 20, 2012
    Posts:
    29
    Hey,

    I'm working with the hololens and it is very sensitive to performance.

    Is there anywhere I can read on best practices with TMP in regards to performance?

    Anything I definitely shouldn't do? like with ugui best fit option

    My first toe dip into performance has shown there are different prices for TextAlignmentOptions.
    A test of 1024 texts with random text. the first chunk is rendered Midline and the chunk in the end is Capline

    upload_2017-9-19_11-36-37.png

    Surprisingly in LateBehaviourUpdate where tmp text uses time it's the same for both.

    I'll continue to explore
     
  2. PaulUsul

    PaulUsul

    Joined:
    Nov 20, 2012
    Posts:
    29
    Exploring all the different alignment options a bit more systematically.
    The bulk of difference is in PlayerSendFrameStarted..
    Sadly the profiler data is a bit to large to upload

    upload_2017-9-19_14-23-40.png
     
  3. PaulUsul

    PaulUsul

    Joined:
    Nov 20, 2012
    Posts:
    29
    autoSizeTextContainer&enableKerning didn't have any effect on vanilla drawing.

    enableWordWrapping cost more as you can see on the right.
    upload_2017-9-19_15-35-13.png
     
    Last edited: Sep 19, 2017
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,625
    For drawing, the size (on screen), number of text objects and shader selection and what features are enabled on the shaders will have an impact on performance.

    Text auto-sizing which is very expensive will have an impact on the cpu when the text is being regenerated.
     
  5. PaulUsul

    PaulUsul

    Joined:
    Nov 20, 2012
    Posts:
    29
    but given the same amount of texts on the screen which features will cost more or less than others.

    TextureMappingOptions didn't seem to affect drawing performance much.
     
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,625
    See the following link from the TextMesh Pro user forum about the shaders.
     
  7. PaulUsul

    PaulUsul

    Joined:
    Nov 20, 2012
    Posts:
    29
    Ah thanks! That makes a lot of sense, I'm already at the unlit mobile text :)
     
  8. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    5,589
    Deep Profile and profiling in the Editor isn't very representative of how a particular piece of code performs.

    Deep Profile in particular often leads to wrong performance conclusions, because the overhead of method instrumentation itself gets expensive really fast and falsifies the results. Deep Profile often causes code, which actually performs fast, to appear as utterly slow.

    In my experience, Deep Profile is useful to find where GC Alloc's are made, or to get an idea what a particular method is actually doing, but I don't use it to judge whether a function needs to be optimized.
     
  9. PaulUsul

    PaulUsul

    Joined:
    Nov 20, 2012
    Posts:
    29
    Ah yeah the images might be a little misleading, all the test are running on a Microsoft Hololens and not in the editor.
    With remote profiling the deep flag doesn't have much effect to my knowledge and the fps with/without attach profiler is minimal I think.
     
    Last edited: Sep 21, 2017
unityunity