Re: Inserting a task into the run loop
Re: Inserting a task into the run loop
- Subject: Re: Inserting a task into the run loop
- From: Uli Kusterer <email@hidden>
- Date: Mon, 23 Mar 2015 01:27:50 +0100
On 23 Mar 2015, at 00:28, Graham Cox <email@hidden> wrote:
> I believe I want my simulation to run "as fast as possible" but because in an idle state a given circuit may simply sit there doing nothing it shouldn't be burning up a lot of processing time as such.
That sounds like you want an NSTimer with a very high frequency, but then set its next fire time to only have it fire when actually needed. That way you don’t wake up the CPU (which is bad on a battery-powered Mac) unless you need to.
Alternately, even better would be if you could calculate several simulation steps in one go. Then you could limit yourself to the minimal frequency, including not simulating anything while your window is obscured or the like, and would at busy times only have to run as often as the framerate of the screen.
Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden