linkWithMesh() causing framerate hit on Firefox and Safari

Hello i am new to this forum and this is my first post :slight_smile:

I encountered a strange behavior when using the babylonjs gui and wanted to report it.
The linkWithMesh- function causes the framerate to tank on firefox and safari, but not on chromium browsers.
This is my playground that shows the problem: https://playground.babylonjs.com/#XCPP9Y#22406
You can open it in different browsers and inspect teh FRAME STEPS DURATION tab in the inspector.
This problem is causing me a lot of headaches, because being able to link controls to mesh positions is important for many of my projects.
Using a custom “linkWithMesh” function also tanks the framerate considerably when moving the camera around:
https://playground.babylonjs.com/#XCPP9Y#22410
I suspect since setting the top or left attribute of a Control, causes a rerender, that something there is really really slow.
I would be really thankful if someone has encountered this and knows a solution or a workaround :slight_smile:

First: Welcome!!! :smiley:

I agree the difference is quite massive between chromium and firefox on my computer too

from 0.5ms per frame to 6ms. 10x slower…

The culprit is a webgl function:

Investigating…

Unfortunately there is no much we can do. This is a slow function in Firefox. I double checked the code and we are simply updating it per frame which is supposed to not be a problem.

I made it a bit faster by enabling premuAlpha:

advancedTexture.premulAlpha = true;

But at the end of the day the problem lies within Firefox guts :frowning:

Thank you very much for answering :blush: I was really hoping there was something i could do about this. So i will probably report this to mozilla and apple :sweat_smile:. They must have gotten some feedback on this in the past. I will try enabling premultiplied alpha… thats a good hint. :+1: and will probably also take a closer look at this later, because that is so insane to me :sweat_smile: Thanks again for the quick reply!

1 Like