Low FPS when using ActionManager in React Native


So I’m working on changing from my custom solution to the actionmanager, but even if I have no actions tied to it it’s eating a lot of fps. Especially on my iPhone X it becomes very noticeably choppy, it’s fine in the simulator but you notice it a lot on the actual devices.
Is this a bug? Or should I be implementing this differently? What could be causing the stutter?

I know it’s also possible to add the actionmanager to the scene, but with my setup it would be ideal if I could have them attached to the objects in the scene that need to react to clicks.

Here’s a repro, this will work fine in an emulator, but it gets choppy on my iPhone, on the Pixel 6 I have for Android it goes from 90 fps to 70 when you’re just clicking on an object which is better but also not great:

The same scene in the playground on the iPhone doesn’t stutter and stays at 60fps:

Let me know if this is a bug/expected behaviour/wrong implementation/something else :smiley:

cc @BabylonNative

bump @bghgary

Sorry for the slow response. Looks like pinging a group isn’t notifying the people correctly. @carolhmj is investigating. I’ll try to investigate this next week.

1 Like

I haven’t forgotten about this. I’m a bit busy, so hopefully will look at this in the coming weeks.

1 Like

Hi! Thanks for the update. I totally understand, whenever you have the time I am still interested what’s going on with this :smiley:

Sorry for taking so long to get back to this, but better late than never. :slight_smile:

I’m trying to repro, but I wasn’t able to get 0.65 react-native working, so I ended up using react-native 0.69. I copied the app.tsx to the 0.69 branch. I’m running on Android (OnePlus 8) right now. What exactly is the repro? I tried clicking and panning. Panning seems fine. Clicking seems to lower the framerate for a split second from 60 to 55, but it comes back to 60 quickly. Is that the problem? I can try iOS also.

EDIT: If I continuously click, then the framerate drops significantly from 60 to 40.

1 Like

The reason why this is slow is because of the picking code. The picking code is quite slow in react native because it does math on each triangle. Babylon React Native does not have JIT and thus this operation is slower than on the web which does have JIT. One possible solution is to implement GPU picking, but this isn’t trivial to implement. Another possibility is to use a model with less triangles. This alien model has over 24k faces.


Hi! Thanks for taking a look at this!
Good to know that this is just a limitation of the implementation used in React Native, it’s an edge case anyway so I’ll just work around it. Thanks for taking the time to explain this :smiley: