Re: Should I observe every object in my view, or just the visible ones?
Re: Should I observe every object in my view, or just the visible ones?
- Subject: Re: Should I observe every object in my view, or just the visible ones?
- From: mmalcolm crawford <email@hidden>
- Date: Mon, 16 May 2005 12:18:10 -0700
On May 16, 2005, at 11:57 AM, Scott Ellsworth wrote:
I have a view that shows roughly 500 objects out of 5000 in the
data store, but depending on resolution and window size, the user
can actually only see about 100 to 150 of them. Currently, changes
to model objects do not show up in the view, and I would like them to.
The fundamental question is, what additional work is done by
observing something?
The fundamental answer as it relates to your situation is *probably*,
the registration process.
If an object isn't doing anything, there's no KVO overhead. If an
object changes, it sends KVO notifications. That represents an
"overhead", but one you'd probably incur anyway as you have to
synchronise your application.
As it relates to a drawing application:
The main question would be, how many off-screen objects will be
changing how often? And if they're changing, will the change bring
them on-screen?
I'd imagine that a significant overhead in the application will be
drawing? And I'd also imagine that the view doesn't redraw objects
that are outside its bounds? So assuming that off-screen objects
change rarely and that even when they do there's no impact on
drawing, the overhead is likely to be negligible. Occasionally a
change might bring an object on-screen, so you'd need to know about
that event anyway.
The only additional overhead, then, is likely to be "unnecessary"
registration of objects. How much of an impact this represents will
depend on usage patterns. Are all the objects added to a document in
one go? How intensive a process is that? Does the user have to wait
now anyway? Do they add objects one at a time? If so, then the
additional overhead of registration will be lost in the noise.
Finally, if you don't observe everything, what will be the overhead
of whatever mechanism you choose to keep track of what it is you need
to observe and what you don't?
mmalc
_______________________________________________
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