Reputation: 2937
I've been playing around with some animations, and it just so happens that I don't have a device nearby to test on. I have a simple animation of clouds moving across a sky. The clouds are animated with this method:
-(void)animateLayer:(CALayer*)layer toPosition:(CGPoint)position withDuration:(CGFloat)duration{
// Prepare the animation from the current position to the new position
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"];
animation.fromValue = [layer valueForKey:@"position"];
animation.toValue = [NSValue valueWithCGPoint:position];
animation.delegate = self;
animation.duration = duration;
[animation setValue:layer forKey:@"cloudLayer"];
// Update the layer's position so that the layer doesn't snap back when the animation completes.
layer.position = position;
// Add the animation, overriding the implicit animation.
[layer addAnimation:animation forKey:@"position"];
}
The layer contains a simple partially transparent image. However, when I run this, the cpu utilization goes up a lot higher than I would expect on my MacBook Air. Is there something I am doing inefficiently? Or does the simulator just chew up a lot of resources on certain tasks like animations?
Upvotes: 2
Views: 435
Reputation: 4793
There is a difference. But on most systems, there is actually a benefit. Things tend to work better on computers, as the improved amount of RAM and CPU speed actually makes things work better. A Macbook Air probably won't improve performance that much, unless your RAM is higher than 2 GB.
Same goes for Wifi, if you have a computer that is plugged into ethernet, then the internet will run faster than normal. It's good to keep that in mind when you are developing, especially with games.
Edit
As Minthos has pointed out, OpenGL might not work as well. However, I can not verify that, as I do not develop things with OpenGL. However, my previous point is still valid in other cases. Simple Cocos2D animations should prefer better on a simulator.
Upvotes: 3
Reputation: 900
I've noticed that an OpenGL app I've written runs much slower on my macbook than on my iphone 4S. This may be due to different capabilities in the graphics hardware - the iPhone has a PowerVR GPU but my macbook has two nVidia GPUs. Perhaps the simulator uses software rendering?
Upvotes: 1