• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is slowing down bindings updates possible?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is slowing down bindings updates possible?


  • Subject: Re: Is slowing down bindings updates possible?
  • From: Marcel Weiher <email@hidden>
  • Date: Sat, 14 Jan 2012 11:53:46 +0100

Hi Andrew,

On Jan 13, 2012, at 6:57 , Andrew wrote:

> The result of this is that the UI updates really frequently and the
> estimated time to complete and the download rate jump around a lot. I
> would love it if I could tell cocoa to only update the UI once per
> second instead of immediately when the property key changes.

You shouldn't push updates to the UI, the UI should query the model, and it should do it at "human speed", not at whatever speed the machine can manage to change the state.  There are a bunch of reasons for this, not least is that UI updating is fairly heavyweight and you can actually impact your performance (significantly, in some cases).

> With a bit of work I could probably set up a proxy object for each
> download that would do something like that and use timer, but it would
> be a lot of messy code.

Not sure why you would need a proxy, or complicated code.  For any long-running task I have I tend to add a method "percentDone" to the object in question ( (100.0 * currentBytes) / totalBytes  or some such ) and then have a timer query that and update the progress bar etc.  Easy peasy.

> I could also just delay updating the
> _bytesDownloaded on a queue. Or a third idea is to cache the estimated
> calc time and rate and then only recalculate the value at most once
> per second.

The estimate is a separate issue, but also one where you definitely want to decouple.

Cheers,

Marcel

_______________________________________________

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

  • Follow-Ups:
    • Re: Is slowing down bindings updates possible?
      • From: Kyle Sluder <email@hidden>
References: 
 >Is slowing down bindings updates possible? (From: Andrew <email@hidden>)

  • Prev by Date: Adding an observer to an NSOperation crashes my app.
  • Next by Date: MAX parsing (Re: TBXML question)
  • Previous by thread: Re: Is slowing down bindings updates possible?
  • Next by thread: Re: Is slowing down bindings updates possible?
  • Index(es):
    • Date
    • Thread