iOS and Cocos2d: my app REALLY slow on simulator but is FINE on device - ios

..I am wondering whether there is some setting I should change to get my iOS 5.0 app running fine on an iPhone IOS 5.0 simulator. It runs at only 12fps instead on my device runs at 60fps. Any help? I would have expected the simulator to work fine..
I am using XCode 4.3 and Mac OS X 10.7.3.

Simulator performance is completely and utterly irrelevant. The Simulator runs on your Mac's CPU, that's multiple times faster than the fastest iOS device. The Simulator does however not use hardware graphics accelerations, so it's easily maxed out even though your Mac is so much faster. Lastly, which of your app's users are going to run your app on the Simulator? Answer: no one!
That said, there is still reason to be alarmed. You get 60 fps on the device, that's great. But which device? If it is an iPhone 4S or iPad 3, that device is a lot faster than older devices like iPhone 3GS (or even older yet) or iPad 1. So depending on which device is the oldes device you're developing for, you might still have a problem. Try to find or borrow such a device, and test it on that oldest-supported device, and do test only with a release build.
Consider the facts:
Simulator performance sucks
Retina Simulator performance sucks even more
iPad Retina Simulator performance is beyond good & android
You're most likely the only person ever to run your app in the iOS Simulator
Therefore:
Simulator performance is irrelevant
Simulator performance can not be compared to device performance
The Simulator is for quicker testing of your app's business logic, nothing else. Not even Samsung copied it.
In addition:
Debug build performance is largely irrelevant. At least verify performance measurements in release builds.
Test on oldest supported device. Otherwise you have no way of knowing whether the previous generation device from the device you're testing on may still render 60 fps or only renders 20 fps. That's quite possible.
Lastly, to answer your actual question: the only thing you could do is to make sure you run the standard (ie non-Retina) resolution Simulator. There's really nothing else you can do besides getting a Mac with a (much) faster CPU.

For graphics, par for course. Dont use simulator for any user experience validation, but stick to devices. Dont waste a minute trying to tweak your workstation settings or looking for ways to improve simulator performance. In any event, your are trying to deploy to devices after all no ?
Some functions work faster on simulator (depending on your workstation of course), like data or computation intensive functions. As always, benchmark on your devices, dont be fooled by 'suitable' simulator performance.

Related

Is the Xcode simulator slower when using a newer simulated device?

I have a fairly old Mac, so I'm trying to find ways that I can speed up the Xcode simulator. I have an assumption that simulating older devices will be faster than newer ones. This assumption comes from the fact that older devices have less powerful processors, so therefore, when simulated, take up less processing time on the Mac. However, I don't actually know if this is true. So will the Xcode simulator run faster if it's simulating an older device?

React native performance simulator vs. real device

I have some questions about the performance of a react native app.
I'm developing a react native app (RN 0.62.2). I'm testing on various IOS simulators as well as on a real device (iPhone 7, ios 13.3).
I'm mostly using the simulator because it's the fastest way to check the output of the code, but when I'm testing on my iPhone 7, I see some performance issues.
First of all: I'm using react navigation. When I open the perf monitor on the simulator and I navigate to a new screen (in the same stack navigator), the JS thread drops with about 6-8 frames (from 60 to 52-54). On the real device with 18-20 frames (from 60 to 40-42). I navigate to the exact same screen.
Secondly, I load local images through require. On the simulator, they appear almost instantly. On the real device, it takes some time before they appear. For example, I have a screen with a background image. On the simulator, it's instantly shown. On the real device however, it takes about a second to load.
I'm using a lot of animations in my app. I'm using reanimated to run the animations on the UI thread. In the simulator, they all work very smoothly, but on the real device, it seems like they are having some issues. They're not that smooth as on the simulator.
Another thing: when entering some text in a textinput (text is stored in a useState-variable while typing through onChangeText={v => setValue(v)}. Frame drops about 6-8 frames on the simulator, but again around 18-20 frames on the real device.
My question now is: what could possibly be the reason for this difference in performance? I've come up with some possible answers, is one (or more of them) correct?
Reason 1: metro server
I'm testing on the real device, so the react native code is still on my laptop. The app is not running on my phone yet, so all request go through the cable which connects my phone to my laptop. This results in some lag.
Reason 2: old device
My iphone 7 is old. I'm running ios 13.3 but the iphone is almost 4 years old. However, when I test on an iphone 7 simulator (ios 11.4), it all works smoothly.
Also I noticed something weird: running the same app in the simulator consumes about the double of RAM memory then on the real device. In the perf monitor on the simulator, when I open the app, or I do some actions, there is more RAM memory used than on the real device (around 30-40 mb, sometimes around 70-80 mb, depeding on the simulator type and ios version).
I have not tested it with a release build yet because my app is far from done. Is there a performance difference between an app testing through the metro server and a release build?
Edit:
I've tested the release build instead of the debug build on my real device. I see a better performance than in the debug build, so that's good. The problem now is: I can't check the perf monitor. Does someone know a good tool to check the performance of a release build?
Great question!
Not aware of any means to run debugger against a Release build. That said - you can run a Debug build on your physical device.
Connect device to Macbook
Open ios/.xcworkspace in XCode
Choose your device and Product -> Run
You'll have access to all the typical debugging niceties - Inspector, debugger, Performance monitor. Assume your Release builds will run faster than Debug builds.

Is the iPhone Simulator actually as "slow" as device itself

I wanted to know whether the iPhone Simulator in XCode "really" emulates the device hardware.
So when deploying to iPhone 4s Simulator, will my app actually be "as slow as on a real iPhone 4S device" and when using an iPhone 6 Simulator, will it be as fast as on a real device?
The simulator does a really lousy job of indicating app performance. In fact it doesn't try.
For most things the simulator is much, much faster than an iOS device. It runs your code on an x86 processor, which is much faster than the ARM and has many times more memory. (It also actually links again OXS frameworks, not iOS frameworks. There is glue code in the simulator that makes it work with iOS code, but it's not perfect.)
However, some things, like Core Image filters and OpenGL graphics, are actually slower on the simulator than on a real iOS device.
The bottom line is that you can't really tell ANYTHING about your app's performance from the simulator, and shouldn't try. You can do basic development on the sim, but when it comes time to test performance, use real devices, and make sure to test on the oldest/slowest device your app supports (usually an iPhone 4s or iPad 2).
You also can't test memory usage on the simulator. A program that will run out of memory and crash on an iOS device may run just fine on the simulator.
The Simulator is a useful tool, and it should not be the only way you
test an app. Because the Simulator is an app running on a Mac, it has
access to the computer’s resources, including the CPU, memory, and
network connection. All of these resources are likely to be faster
than those found on a mobile device. As a result, the simulator is not
an accurate test of an app’s performance, memory usage, and networking
speed.
Source

Do I need to separately test on iPod touch, iPad and iPhone?

I would like to start developing for iOS. Coming from an Android developing background, I know that the more types of devices you can get your hands on, the better testing will be, as all devices have wildly different specs, and what may work perfectly in your test device may not even run in another one, let alone look good.
I know that testing on the actual device is very important, as there are many limitations on what you can test on an emulator, so I've decided to get an actual device.
However, there are also tons of devices available in the iOS world! There's the iPod touch, the iPad and the iPhone, each in several different generations and configurations (8GB version vs 16GB version, WiFi version, 3G version, etc.). Not also the screen sizes, but also the aspect ratio is very different across devices, and also the included sensors.
I think that getting an application to run in varied devices should not be difficult, but is it necessary to actually test on all the device types you plan to support? Apple is not renown for its low price, and I would like to keep the starting costs as low as possible.
So, to conclude: Is it necessary/recommended to test on as many device types as you can in the iOS development world?
A small clarification: I'm specially asking if it is possible for there to be compatibility issues related to a specific device/family-of-devices that I would not be able to catch either by testing on the emulator nor a totally different device.
Generally speaking, the major differences in capabilities between testing on the simulator and testing on a device are:
The simulator does not use exactly the same sandboxing as the device. So, for instance, if your provisioning profile is missing your Passbook credentials, this problem will show up on a physical device but not on the simulator.
The simulator doesn't generally support GPS, multitouch, push notifications, Bluetooth, and some other specific features.
On a non-retina display, the simulator view for an iPhone 5+ or (especially!) a retina iPad will be nigh unusable at 100% because its size will exceed the size of your screen.
There are a few, very rare, crashes that occur only on the simulator and a few that occur only on the device.
The simulator does not always support the earliest iOS versions your app supports. For instance, the current version of Xcode (which you must use if you want to build for the latest iOS version) only has simulators from 5.0+ available.
Certain profiling with Instruments is, as far as I can tell, only available in the Simulator.
Now, in my specific case, I try to test on one of each screen resolution I support and one of each major OS version I support.
This boils down to the following array of test devices:
(480x320) iPhone 3GS running 4.3.3
(1136x640) iPod 5gen running the latest 6.x
(960x640) iPhone 4S running 6.0
(1024x768) iPad 1st gen running 5.0
(2048x1536) iPad 4th gen running the latest 6.x
Note that the iPad mini is the same resolution as the iPad 1st gen.
(My choices are skewed towards later iOS versions since I like to implement integration with all of Apple's snazzy optional features as they roll them out. It would probably be a more balanced assortment if one of the 6.x devices were running 5.1 instead.)
If you don't need to support 4.x, I would personally advise against it, since iTunes Connect no longer collects crash reports for it and the simulator no longer offers it. Of course, only you can decide whether you really need to or not, and if you do, focus a lot of your testing there as Xcode does not warn you if you are using APIs that were only introduced in 5.0, which will crash any device running 4.x.
Please note that there are ways to (with significant preparation) downgrade the version of iOS on a device, so if you really want to test more versions than you have devices for, you can (with a lot of effort). But you're probably better off cultivating a strong pool of beta testers for this, anyway.
Whilst it's obviously great to test on all possible devices, the iOS ecosystem is much tighter than Android, so you can narrow down the field somewhat.
You can start by limiting your target iOS versions. That will anyway cut out a number of older devices. iOS6 share of all iOS devices is now probably around 75% 4 months after release; iOS5+iOS6 upwards of 90%. If you are just now starting to develop for iOS, you could probably just target iOS6.
That means your minimum hardware platform is iPad2 / iphone3GS / ipodTouch4
Total list of devices
iPad: 2 3 4 mini
iPhone: 3GS 4 4S 5
iPod: 4 5
Ten devices.
But you won't need to test them all. You could sensibly narrow it to...
iPad: mini + one of the retina models
iPhone: 3GS + 5
for everyday testing.
Obviously if you do want to be more back-compatible, just replace the lower-end testing model for a lower-spec device (iphone 3, iPad 1).
The difference in storage capacity (8GB vs 16GB for example) will be mostly immaterial.
There are some hardware features you will have to pay special attention to, depending on your project. The obvious one is retina vs non-retina displays. Hardware features for location services is particularly nuanced between models.
Lowendmac have a pretty thorough iphone comparison chart...
I think that getting an application to run in varied devices should
not be difficult, but is it necessary to actually test on all the
device types you plan to support?
That depends a lot of what kind of apps you intend to build. For example, universal apps run on both small- and large-screen devices but may present themselves differently on each, so you'd want to be able to try both. Many apps target iPad specifically, so obviously testing on small devices isn't necessary. iPod Touch and iPhone are very similar, so testing on one or the other is often sufficient.
In short, you don't have to own every version of every device, and you don't probably don't have to test on every single version of iOS that's ever been released. But you do want to get your product tested on as many different devices and operating system versions as you can. So, cultivate a group of beta testers who will help you out by trying your app on their devices. The iOS developer program lets you add up to 100 test devices to your account precisely so that you can get your app tested in lots of different circumstances.
Testing on the iPod touch is generally not worth it.
In the iOS world, there is generally the iPhone/iPod, the iPhone 5/iPod 5th generation, and the iPad.
So, that is a total of 3 screen sizes.
If you plan on targeting more than the latest OS (iOS 6), that is where the complexity of testing comes in. Simply targeting iOS 5, and iOS 6 nearly doubles the amount of targets you need to test for.
I try and keep it simple. I test on my iPhone 5, and my iPad. Both of those run iOS 6. For iOS 5 and the small iPhone, I rely on the simulator.
I develop for both Android and iOS, so I get where this question is coming from. I have the luxury of being able to develop on most of the different iOS devices and I would say that in most cases I would feel comfortable testing on the least advanced device my user will be using. If it runs smooth on a iPOd 3rd gen then it is going to run very smooth on an iPhone 4S, 5, etc. For the different screen height for the iPhone 5, the simulator works very good with laying it out.
Things you will need to consider is if your apps have the option to use certain feature only a phone would have, like making calls. Also if you want to make a iPad or universal app, it would be very handy to have an actual iPad, but the simulator does work very good.

phoneGap app for iOs: if application works in xCode device emulator

I've got a newbie question about phoneGap and creating apps for iOs.
If my phoneGap app runs in device emulator in xCode and everything is ok, can I be sure that it will work the same way on a real iOS device when I publish it in the appstore?
The XCode simulator does what the name suggest - 'simulates'. It is not identical to the actual hardware, for a number of reasons. Here are just a few of them:
Performance - your computer has much more memory and processing power available than the phone itself. Your app may run fine on the simulator, but quite slow on the device. This is why it's a good idea to run on the device itself, especially if you're doing stuff which could use up a lot of memory.
Missing features - the simulator doesn't allow certain things to be tested, like in app purchase or media/asset management. And obviously you're missing things like the camera, the accelerometers, compass, etc. You can from iOS 5 simulate certain things like the GPS, but nowhere near everything.
Visuals - the simulator runs at your monitor resolution, whereas the phone itself has a much higher DPI display. Things that look readable or fine on the simulator can on device look very different.
If you're not testing your app on an actual device before releasing it to the app store you're doing a disservice to your users - this is Apple's point of view, and one shared by most developers. It's not necessarily what you might want to here, but unfortunately the simulator really is just that - a simulator. You wouldn't want to be in a plane piloted by somebody who had only trained on a simulator. And you probably wouldn't want to use an app that had only been run on the iOS simulator.
Here's what Apple have to say about it in their own documentation:
Although you can do much of your debugging and testing of an iOS application using iOS Simulator, simulation cannot completely match the results of running your application on the target devices; you must test your application on actual devices to ensure that it runs as intended and to tune it for performance on actual hardware.

Resources