Running React Native with (expo's) GLView has probably terrible performance in iOS simulator, making it unusable to develop your application.
My setup:
"expo": "~47.0.8",
"expo-gl": "~12.0.0",
"expo-three": "^7.0.0",
"react": "18.1.0",
"react-native": "0.70.5",
"three": "~0.145.0"
Running simple rotating Cube scene renders few FPS on M1 Mac running in iOS Simulator (iPhone 14Pro, iOS 16.1)
The same project runs flawlesly on Androd simulator (Android 13 SDK, API33, pixel device)
What can be done to speedup the rendering?
TLDR:
Disable the antialiasing that is enabled by default for iOS devices in GLView component.
When creating GLView pass msaaSamples property and set it to 0 (default: 4)
<GLView
msaaSamples={0}
onContextCreate={....
This will bring the performance close to the Android simulator.
Why this helps?
I am just guessing its some memory issue. Mobile retina displays on its own use like 2K pixels. Adding 4 times Multisample anti-aliasing (short msaa) quadruples the amount of video memory needed to store one frame.
Note: Feel free to add more comments how to squeeze more performance out of it and I can incorporate it in this answer.
Related
SceneKit uses for SCNView in iPhone 6 on simulator OpenGL,
this causes to changing lightning model from PBR to Phong
Error: Physically based lighting model is not supported by the OpenGL
renderer, using Phong instead
Is there a way to fix it?
Newer iPhones render model in SceneKit correctly in PBR
SceneKit uses Metal in the simulator since Xcode 11 running on macOS Catalina. On previous versions of the system only OpenGL was supported.
In Xcode 11, Simulator adds support for Metal development. You can write iOS and tvOS apps that use Metal and test them in the Simulator, gaining the benefits of hardware acceleration on the Mac during development of your app. If you use frameworks built on top of Metal, such as SceneKit, Core Animation, and UIKit, you'll also see better performance when testing your apps in Simulator.
(https://developer.apple.com/documentation/metal/developing_metal_apps_that_run_in_simulator)
As per title, simulator is super slow, so my questions is there any way to improve OpenGL performance in iOS simulator?
The Simulator supports GPU acceleration for Metal starting with iOS 13 on macOS Catalina. OpenGL ES is still software rendered and is likely to remain that way.
I strongly recommend moving to Metal.
I have two questions about the iOS Simulator in Xcode for my Unity game:
I am using latest version of all the software involved.
1) Why is it so slow? (I have tried the Cmd+T solution and it does
nothing. Note: The game runs smooth even on a real iPhone 4)
2) Why is the size of the iPad simulator screen bigger than my laptop screen? (I know you can
scale it, but just curious why Apple always tries to make our life
difficult)
When you run game on iOS simulator then your game image runs not completely running on your mobile hardware actually runs in compression mode so seems to be slow.
Having high resolutions Apple deceives have bigger number of pixels on their screen, so its not Screen size but it Screen pixels what we need to concern. And it is for creating more smooth effects on visuals for animation, it is to provide user better quality graphics, not to make your life difficult
I'm fairly new to developing. My app is graphic heavy with some animation using timers. I am testing on a 4th gen iPad retina. In simulator (Xcode 5) the timers I have going for animations run slower than on the iPad, and some other graphic features (like things fading in and out) don't work the same in simulator as the iPad build. Should I trust the iPad's build and not the simulator? Should I also test on different iPad models to check if the graphic animations run correctly on different models or are they likely to run the same?
I focus on UI art & have experience with making graphics rather than dealing with the Xcode environment itself, so any info about how programmed animation views display on different devices or different environments would be really helpful.
Rule one of developing apps: Always test on a hardware device
The hardware device has a ARM CPU for dealing with normal stuff like calculations and a GPU to accelerate the graphics. The GPU's on iOS devices are pretty powerful and comparable with GPU's of desktop computers a few generations back. Your simulator does not have that and will have problems rendering some of the more heavy stuff because it simulates the device and does not run directly on actual hardware.
I would also suggest that you check out the slowest device possible for the iOS generation you will be targeting in hardware. For instance an iPhone 3GS will still run iOS 6 applications. So if you are targeting iOS 6 or better and it runs well on that device, it will be doing fine on all others in terms of performance.
I am developing iOS app and android app using adobe AIR and Flash CS6.The app contains lots of animations. Since Bitmap images do not give a good quality, I have kept the images in Vector form only. It runs fine on android devices but when I publish it on iOS device many animation lags. How can I solve this without affecting the quality of my animations? I am using AIR SDK version 4.0 and GPU rendering method. Any help would be appreciated.
There might be a few things you could try:
use TweenMax/TweenLite for your animations as the GreenSock library is optimized for performance
try setting cacheAsBitmap to true on the vector you're animating
convert vectors to cached bitmap data (http://esdot.ca/site/2012/fast-rendering-in-air-cached-spritesheets)
try see if using "direct" mode for rendering yields better performance; from what I've experienced GPU is not well suited for vectors