Bulletphysics in while loop very slow in device

I am creating a Pool/Billiards game in cocos creator.
For AI calculation, I am running physics in while loop for some iterations and select best shot. Issue is everything works instant in browser (<2 seconds for complete 30 shots), but when I run it in simulator or device (iOS/Android) it takes ~30 seconds of time.
There is nothing much in scene, only 16 balls (sphere rigid bodies), and a Trigger to check if ball is pocketed or not.
I tried “await nextFrame()” kind of logic after every few iterations inside while loop but nothing much improved.
I searched for Multithreading in cocos creator but didn’t find any documentation related to it.
Please help me in this.

When publishing to native platforms, PhysX physics is recommended for better physics performance, you can try it.

I Tried PhysX as well. In iOS it shows better performance, but Android it is taking same amount of time.
Is Multithreading supported in cocos2dx/cocos creator? Can someone help in finding some example of running physics in another thread using cocos creator or native cocos2dx using binding?