Iphone Simulator - Allocates way too much memory and runs slow compared to device - iphone

I've seen plenty of posts about the simulator running slow, but my problem is different.
I ran my app with instruments and saw that in the device, the app uses about 8mb of live memory when the app is running. In the simulator the live memory is about 50MB, and I have no idea why this is.
This causes the simulator to lag and I need it to run smooth so i can take a nice screen capture video of my app.
Any ideas?

There are a number of steps in the OpenGL ES 1.1/2.0 pipeline that are done in software when running on the simulator (as the Mac GPUs are plain OpenGL) but are hardware accelerated when running on the device (hence it actually running faster on the device).
From the documentation:
Important: Rendering performance of OpenGL ES in Simulator has no
relation to the performance of OpenGL ES on an actual device.
Simulator provides an optimized software rasterizer that takes
advantage of the vector processing capabilities of your Macintosh
computer. As a result, your OpenGL ES code may run faster or slower in
iOS simulator (depending on your computer and what you are drawing)
than on an actual device. Always profile and optimize your drawing
code on a real device and never assume that Simulator reflects
real-world performance.
This definitely explains the speed discrepancy, might also explain the extra memory taken up when running in the simulator.

Related

Testing iOS testing on real devices vs. Simulator

I am new to iPhone/iPad development and I am close to finishing up my first app and I am looking for some general advice.
I know it is important to test on actual devices and not just the simulator. What are the types of things people generally encounter when testing on a deal device that they don't see in the simulator?
The app itself is mainly a way to track online deals and that type of thing. It doesn't need anything special in term of using things like the camera or GPS.
It's just general usage testing. The device performs in an entirely different environment than your computer, and it's the best way to make sure if you push your app out to devices, that nothing unexpected will happen. For example, the phone/pad may have limited data coverage, low memory situations, incoming calls etc.. These situations are a lot more common on devices, then when people emulate it though the simulator.
On a hardware point of view, the device uses a different processor architecture than your Mac, which also needs to be accounted for (not as much as other cases, but you need to cover your bases). The Mac also cannot reliably emulate RAM, Disc Space, Processor Speed etc...hence testing on the device is useful here also.
Obviously there are some features you can only test on devices, such as Camera, GPS (and not so obviously iPod library usage), and if your app uses them it'd be careless not to test on a device.
Overall if you're intending to release your application to the App Store, or to devices at least, it's worth testing on the device itself. Only then can you be sure that it will act and perform as expected on the platform you intend to target. The simulator is only a simulator after all, not the real thing!
First of all: the user experience is very different.
The mouse based interaction is very different from a touch interaction. focusing at a monitor feels very different then looking on a device on the palm of your hand.
Also the experience of animations running on the simulator and the real device can be very different.
And the usage in the simulator won't tell you anything about the battery consumptions to be witnessed on the real device.
My opinion: every app that will be shipped to the App Store or customer for testing should be tested several different real devices. No excuses.
Simulator runs a lot slower than the real device.
Real device could run out of memory when Simulator doesn't or vice versa.
In app purchases, if you have included them
Orientations (not that
they are unavailable on simulator, but it is easy to forget it
there!)
App life cycle testing - bringing your app to foreground and
background.
Network access - can matter when you access the network from device through wireless or cellular network vs LAN/wifi on your mac. There is a huge testing to be done under the umbrella called Reachability if your app uses any of the resources across the net. You are bound to provide an alert if network is unreachable before using any such resources, as per app store requirements.

Do you have to have iphone to make iphone apps?

Can you make iphone apps without owning an iPhone? I have a macbook but wondered if maybe there was an emulator you could see your programs on to build your app. All the articles I found were a couple of years old.
Thanks.
You CAN use JUST the emulator to develop apps and for the most part, it works the same as the actual device. Memory and some hardware items behave differently on the device, so it can be be difficult to find bugs before the app gets into the hands of your users, and performance on the device will not be as good as the simulator.
Also, things like the Camera, Location Services, Accelerometer & Gyroscope will not be usable in the simulator.
In theory you can (Xcode comes with a simulator) but in practice I don't think you can. Several things don't work in the simulator or work differently so you won't be able to test if your app works properly.
The practical differences between the simulator and a real device are:
Runs faster than the real device.
Internet access is treated as WiFi. It doesn't emulate 3G.
You can't tilt or control acceleration.
You can touch with one or two (holding alt) fingets, but not more.
It doesn't vibrate.
Some sounds and musics don't run on the simulator.
Accelerators, camera, gyroscope, and GPS return fixed data. Your position reported is always Cupertino, the camera is blank, and the sensors report 0.
It can't be jailbroken.
Keychain doesn't work.
However, that's good enough in 90% cases to develop functional applications.
It is certainly highly recommended so you can actually test on a real device. Apple provides a pretty good simulator for doing the majority of your development on, but things like testing memory usages, performance and making use of features such as a camera, location api, accelerometer, etc, you'll need the device.
Certainly, start developing using only the simulator (if you are not sure you want to do iPhone development), but I would recommend getting a device (iPod Touch is a cheaper alternative) if you decide you want to move forward.
It depends on what you are trying to write. All functions of the device are not available in simulator. For example accelerometer. So if you need that then you can't work without the device. And also the simulator uses Mac environment which is far more powerful, both in terms of processing power and memory. So your app may run well on simulator, but may work poorly and even crash on device. So it's better to have a device for serious development. But obviously you can start learning on simulator.
If you want to write apps that don't suck you will need an iOS device. Period.
Doesn't matter if it's an iphone, ipod touch or ipad.
I never had an iPhone and wrote a dozen apps for it. In fact I still use my old iPod touch 2G for development.
But I wouldn't recommend that particular one for development, because now its end of life and you won't get firmware updates for it.
But last generation is totally fine.

Specify minimum memory requirement for iPhone app

My application requires at least 40MB of RAM, so earlier iPhones (like 3G, first iPod touch versions) just do not have it (they have max about 20MB for my app). Is there a proper way to disable installing it to 3G devices? I know UIRequiredDeviceCapabilities, but it does not have parameter for minimum available memory.
First, are you sure that your application actually uses 40 MB of RAM on the older devices? I've found (by using the Memory Monitor instrument) that the same application uses less RAM on my iPhone 3G than it does on my iPhone 4 or iPad. The latter two devices have more pixels within their interfaces, so my application chews up more memory when running on them.
If it does, figure out if you can optimize memory usage to get it within a safe (< 30 MB) range for the older hardware. If you can do this, I think you'll see an across-the-board performance improvement in your application, even on the newer hardware.
Finally, if you absolutely cannot run on an older iOS device, I'd recommend using the UIRequiredDeviceCapabilities keys armv7 or opengles-2. Either will filter for the newer (iPhone 3G S and greater) hardware. While not keyed on memory size, the iPhone 3G S launched with significantly more RAM than the older models, and not a device since has had less. It's hard to imagine Apple reducing this specification at any point in the future.

3G iphone touches less responsive than other devices?

I'm developing a game for the iPhone and I've noticed a difference specific to the 3G iPhone. I have been testing the software all 3 versions of the iPhone - 2G, 3G and 3GS. The 2G and the 3GS work the same, but I find on the 3G that the swipes and touches are much slower to respond. At first I thought it might just be a CPU issue, but the 2G iphone is slower and works the same as the 3GS.
Is this a known issue? Is the 3G iphone known for having a different touch sensitivity?
I suggest you restart your device and see if it is more responsive.
I personnally did not feel any difference in my games applications.
Turns out the game was just chewing up CPU. When the iPhone is running at load, the touch performance goes down, making it seem sticky and less responsive. I've tuned the app and it now works the same on all the machines.

iPhone/iPod touch CPU/GPU performance

How many bogomips (or any other relevant unit) can an iPhone or iPod touch deliver?
Is performance in larger applications, as on normal PCs, more limited to cache thrashing than to number of CPU instruction? Or is there some other limit?
What is a recommended total polybudget for a state-of-the-art game in a plain iPod touch (i.e. not iPhone 3GS)?
Does the ARM-11 in the iPod touch and the Samsung ARM in the iPhone have an FPU with the same performance as that of a normal PC, scaled to the core clock frequency?
The reason I'm asking is that I want to port a game with a physics engine (i'm using ODE). If you know anything else I should look out for, don't hesitate to mention it!
GLBenchmark has published a series of benchmarks for various mobile devices, including the iPhone, iPhone 3G, and iPhone 3GS. For example, the iPhone 3G appears to be capable of rendering 687,000 smooth shaded triangles per second (the best I've actually been able to get in my application is 460,000).
In regards to the CPU, the ARM processor on the iPhone has native floating point support, and even has a vector floating point unit. In comparison to a desktop, I ran a computationally intensive operation (NSDecimal addition) on both my desktop (in the iPhone simulator) and on the device (non-3G iPhone). The desktop (MacBook, white, 2.0 GHz Core 2 Duo) did 3344593 operations per second, where the iPhone did 281555. The desktop, which scored 2.64 Gflops on Xbench, was 11.88 times faster than the iPhone. Whether this means that the non-3G iPhone is capable of more than 220 Mflops would require more testing.