delayed read-only bindings (suggestions/hints) ?
delayed read-only bindings (suggestions/hints) ?
- Subject: delayed read-only bindings (suggestions/hints) ?
- From: Nicolas Berloquin <email@hidden>
- Date: Wed, 21 Apr 2004 11:53:30 +0200
Hello !
<context>
I'm using bindings a lot for a network application that shows the
status of connected
remote peers. My problem is that currently, as data arrives, I update,
for example some
model values that sum received data. This value is bound to a table
column.
When data arrives very fast, the window gets updated *very* often,
resulting in my
app's cpu usage between 40-70% and WindowServer around 70% (I have a
few fields
updated that way...)
</context>
So all this brought me to the reflexion that I need to delay the update
(no need to show
what is going to the user every 10ms ;-)).
I'd like to discuss how you guys handle that type of problem.
I thought about two different solutions:
- One, which I already implement for some values, is to have an NSTimer
fire every second
that updates a second (mirror) value with whatever changes apply. This
mirror value is the
one that is bound to the tableColumn. This works fine, but I don't know
how expensive are
NSTimers (what if I have a dozen running ? a hundred ?)
- Second solution would be to "hack" the NSArrayController. (Please
remember that this is
for READ-ONLY values, displayed in a window). I haven't tried this yet,
but I thought about
things like unbinding/binding the arraycontroller every n seconds. How
expensive is the binding
/unbinding in this case ?
Or caching the observed value changes, then batch-updating all the
updates every n seconds
(ugly/complicated eh ?)
Any plans for an NSTimedDelayArrayController ? ^_^
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.