Re: Stopwatch
Re: Stopwatch
- Subject: Re: Stopwatch
- From: Eric Brunstad <email@hidden>
- Date: Sun, 12 Jun 2005 15:55:40 -0400
On Jun 12, 2005, at 3:41 PM, Joshua Orr wrote:
On Jun 12, 2005, at 3:12 PM, Sanri Parov wrote:
On Sun, 12 Jun 2005 11:14:42 -0700, mmalcolm crawford wrote:
Use an NSTimer instead:
<http://developer.apple.com/documentation/Cocoa/Conceptual/Timers/
index.html>
Ok.
But that's not the point. When it comes to fire the timer, the whole
interface freezes.
That's why I used a different thread.
How often to do plan to fire the timer? In one of my
applications, I fire a
timer every 30th of a second, and I do not notice a substantial
interface
freeze.
One important consideration: From my experience I have noticed
that when fired
at rapid rates, the NSTimers do not always go at the exact
interval they are
told to go at.
Were you using the main thread to do the calculations? NSTimers
rely on
NSRunLoop, and if you where not letting your program get back down
the run
loop during the complex calculations, then that’s probably the
problem.
If you do your calculations in a different thread, you may see better
results.
Actually, the NSTimer was going so slowly that I used my wristwatch
to time it.
I put a NSLog() in the method the timer calls, and started my
wristwatch. Five minutes later, I counted the # of logged strings.
I know this is not an accurate way to see the speed of the NSTimer,
but I just wanted a general idea of its speed.
Of course, this is a very extreme situation. The NSTimer was
responsible for playing multiple movies, rendering complex graphics,
and more. It was supposed to give a real-time preview of a rendered
movie, but obviously it was too slow.
-Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden