"live bytes" different on simulator versus device - ios

I have a program that is showing, in the allocations instrument, approx. 72 MB of "live bytes" but when I run the profiling on my iPod touch, it shows 6 MB. I don't understand why the vast difference. Can anybody please explain this?

Keep in mind that the iOS Simulator is a simulator, not an emulator.
The iOS Simulator works by compiling your iOS application to x86 code, and linking it against a set of system frameworks which simulate their iOS equivalents on a desktop computer. These frameworks are, of necessity, not identical to those that you'd find on "real" iOS -- they are, after all, compiled for a different CPU architecture, and are "talking to" desktop hardware, not a handheld device.
Knowing this, it should be understandable that some aspects of application performance may be radically different on the Simulator than on a real device. Keep this in mind, and test your code early and often on real hardware!

Related

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

iOS Simulator CPU load

When looking at the performance of an app on the simulator, I can see the CPU load.
Is the CPU figure a simulated load on a real device, or is it the load on the Mac's CPU from running the simulator?
I understand that neither would tell me much about the real performance on device, and I do regularly test on device. But I was wondering if anyone know, or if there's any information about what this number means.
No the iOS simulator is not replicating an iOS device in terms of performance. The numbers are simply the load on the Mac's CPU and are not a good indicator of performance on a real ARM iOS device.
The simulator numbers may be ok for comparing relative performance of some operations, but you should be sure to test on device, especially when using other hardware features such as the GPU.

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

..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.

arm6 devices showing much higher memory usage

I have built an app in MonoTouch - it works with both arm6 and arm7 devices, I've tried to be as careful as possible with my memory usage and on the arm7 devices it works beautifully - running it through the apple instruments program I can see an average 'live bytes' in the allocations tool of around 4MB.
However on the arm6 devices (iPhone 3G, iPod touch 2nd Gen) - it is instead showing memory usage of around 22MB - gives frequent low memory warnings and obviously eventually crashes.
Is there any build setting or any particular thing that anyone can think of that could be causing the app to have such a high memory footprint on the 3G device vs the 3GS (arm7) devices?
It's especially frustrating as these devices have plenty of memory anyways.
Thanks for your time,
Liam
That's a huge difference!
My best guess is that Apple's Instruments is misreporting the memory being used (in either or both case) and that, in fact, the real memory requirements of both are much closer.
In this case the older, armv6, devices have less RAM and will give low memory warnings before the newer, armv7, devices (with more RAM). IOW the behaviour you're seeing could be normal, i.e. you could be near the limits for older devices.
Now it could also be a bug or some other configuration that differs between your builds (e.g. a Debug versus a Release build). It would be helpful if you could share (or create a test case) this with us (Xamarin) so we can try to reproduce the issue.
NOTE:
I assume you're talking about a single, armv6, application used on different devices. But even if you used different builds (one for arm6 and one for armv7 or a fat application) this would only affect native code generation. As such it will affect the binary size but it should not have a (huge) effect on the runtime memory requirement of applications.

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