Re: Best practice with NSProgressIndicator
Re: Best practice with NSProgressIndicator
- Subject: Re: Best practice with NSProgressIndicator
- From: Charles Srstka <email@hidden>
- Date: Fri, 28 Jul 2017 13:26:43 -0500
If you’re using Swift, I made a custom replacement for NSProgress that is
specifically designed to cut down on CPU time used to update the progress. It
allows you to set the granularity for notifications, so that they’ll only
update when the progress has changed since the last update by an interval of
your choosing.
You can check it out here if you like:
https://github.com/CharlesJS/CSProgress
<https://github.com/CharlesJS/CSProgress>
Charles
> On Jul 28, 2017, at 10:57 AM, Mark Allan <email@hidden> wrote:
>
> Hi all,
>
> I'm wondering if anyone has any thoughts about or links to best practices
> when using determinate NSProgressIndicators.
>
> I have an app with a helper tool that performs some lengthy process in a loop
> and reports progress to the user. It works out how many iterations of the
> loop will be needed, sets the progressbar.maxValue, and then increments the
> progress bar's value on each iteration.
>
> The consumes a large amount of CPU time just for updating the progress bar,
> so I'd like to cut down how often I update it.
>
> Setting the max value to 100 and only updating 100 times (i.e. as a
> percentage) seems too infrequent because the loop can iterate more than a
> million times.
>
> I'm debating doing it with an NSTimer firing every second, but wondered if
> anyone had any other suggestions?
>
> What are people's thoughts?
>
> I've tried searching online and the only problems/solutions I can see are all
> related to people's progress bars not updating properly because they're
> blocking the main thread etc. I can't see anything related to best practice.
>
> Many thanks
> Mark
>
> PS. It could be that this is a case of premature optimisation...but I don't
> think so!
> _______________________________________________
>
> 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
_______________________________________________
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