GUI.TextWrapping.Ellipsis seems to be causing performance issues

I’m working on a project where we have about 40 labels being ellipsed at the same time. As I zoom in the text wrapping is triggered, this causes a significant drop in my FPS (from 60 to 15)

Here is a PG showing my implementation for a single label: See line 80

https://playground.babylonjs.com/#XCPP9Y#11108

I don’t see any performance issues with a single label being ellipsed (either in the playground or my project) but I have around 600 labels with 40 visible when the text wrapping is triggered.

Do you have any ideas on what is causing this?

Are there any optimizations I could use to avoid this issue?

Thanks!

Screen Recordings:

Hello and welcome to the Babylon community! This does like a bug to me, reproduced the same behavior in another example: Simple GUI in fullscreen mode | Babylon.js Playground (babylonjs.com)

Opened an issue for it on Github and we’ll work on tackling this right away! Ellipsis text wrapping performance · Issue #12011 · BabylonJS/Babylon.js (github.com)

Thanks for the quick response!

If it helps I think it may be related to the issue discussed in this thread:

Oooh that’s a good catch! The processMeasures function indeed is called on this path, but checking the Performance tab on the browser debugger led me to finding that the bottleneck was the measureText function. So I reworked the algorithm a bit to call it less times, it improved the FPS a lot :smiley:

PR is here! Update text ellipsis algorithm to try removing more than a character … by carolhmj · Pull Request #12016 · BabylonJS/Babylon.js (github.com)

3 Likes

Thanks very much! Appreciate it