Pointerover event bad performance

I have an issue with the pointerover event. As you can see in this screenshot, the event represents almost 10% of my scripting which is a lot:
pointerover heavy
I have already done this.scene.detachControl(); in order to avoid picking as this is not necessary for my case but the event is still triggered for this other task loadHandler

I think this event is triggered by pep but I do not know how I could shut it down from BabylonJS?

Thanks a lot for your help :wink:

The one impacting perf here seems to be (Function Call) so an anonymous call from over.

we are not directly listening to it in Babylon so could you check and share the code from function call in order to see what is actually being called in babylon ?

Here it looks like it is a texture loading which is intriguing.

Hello @sebavan!

After some digging, I realized there were other functions depending on pointerover.
A simple window.addEventListener("mousemove", (evt) => { this.mouseOrientation(evt) }); is calling this event.

But this is crazy it takes so much scripting just to trigger this simple event. :astonished:
Do you think I should ask the google chrome team ? :thinking:

I do not think it is a browser issue here, first would be good to know whats inside ?

Well there is several stuff.

For instance one thing we do is that we stop the rendering of the scene when the mouse stop moving and we start it back when the mouse is moving again. But in average this represents max 2% in the Function Call.
Everything else is very small in terms of scriting and if I sum everything I do not have 10%. So most of the part is coming from the Function Call as you said but we do not have control on that function. Or I donโ€™t know how we can impact it.

the thing is that if it is part of your code, you should be able to see what it is ??? Else share a repro unminified where we could have a look.

Well I am not sure to understand how I can see it. To give you an example, when I do window.addEventListener("mousemove", (evt) => { this.mouseOrientation(evt) });
We can find that function in the call tree here:
pointerover heavy2

So this is just an addEventListener and I have no way to know what is done before in this Function Call ?

Sorry to bother you with this none babylonJS related question. :sweat_smile:

So Function Call is just the native browser one and basically you should mainly try to optimize the level below it.

So here _onPointerMove which is normally used to manage inputs so it is really hard to tell without unminified code or a playground repro

Ok thanks a lot for your help @sebavan, I will continue my research on my side. I donโ€™t want to pollute the forum with something not related to BabylonJS! :wink:

no problem do not hesitate if we can help :slight_smile:

1 Like