I'm making an app with some animated content in a view. There's also a timeline with a playhead.
The playback is controlled using an NSTimer. I've tried both using a fixed 0.02s time interval and a variable interval that was calculated after the frame. The actual delta time is calculated by checking the difference in system time ([NSDate timeIntervalSinceReferenceDate]) between the previous and current frame, so I'm not relying on that 0.02s interval.
This all works great on my alu iMac. It's silk smooth.
On my PowerBook G4 though, the animation is pretty choppy. This is especally visible for the playhead, which moves at a very irregular tempo. But somehow the irregularities are regular, it's like there's a pattern. It speeds up and slows down a bit with regular intervals.
I've tried profiling with Instruments on the G4. But 80% of the time is spent in mach_msg_trap. From IRC and some Google searches I've understood that this simply is time where my app isn't doing anything and it's waiting. That seems to imply that there's no CPU bottleneck.
So what is causing the choppy playback? Is it the timer? Is it the way I find out the delta time ([NSDate timeIntervalSinceReferenceDate]) between frames? Is it somehow memory related? How do I found out?
The playback is controlled using an NSTimer. I've tried both using a fixed 0.02s time interval and a variable interval that was calculated after the frame. The actual delta time is calculated by checking the difference in system time ([NSDate timeIntervalSinceReferenceDate]) between the previous and current frame, so I'm not relying on that 0.02s interval.
This all works great on my alu iMac. It's silk smooth.
On my PowerBook G4 though, the animation is pretty choppy. This is especally visible for the playhead, which moves at a very irregular tempo. But somehow the irregularities are regular, it's like there's a pattern. It speeds up and slows down a bit with regular intervals.
I've tried profiling with Instruments on the G4. But 80% of the time is spent in mach_msg_trap. From IRC and some Google searches I've understood that this simply is time where my app isn't doing anything and it's waiting. That seems to imply that there's no CPU bottleneck.
So what is causing the choppy playback? Is it the timer? Is it the way I find out the delta time ([NSDate timeIntervalSinceReferenceDate]) between frames? Is it somehow memory related? How do I found out?