Should I observe every object in my view, or just the visible ones?
Should I observe every object in my view, or just the visible ones?
- Subject: Should I observe every object in my view, or just the visible ones?
- From: Scott Ellsworth <email@hidden>
- Date: Mon, 16 May 2005 11:57:30 -0700
Hi, all.
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.
Adding appropriate observers seems like the best way to do that, as I
already have a method that marks the rect for an object as stale on
changes.
I could
1. Observe every object that the view could show
or
2. Write code that adds observers to objects as they come into view,
and removes them as the go out of view. I believe NSTableView does
this.
Normally, I would just implement the easiest thing, then profile to
see if it can be made better. I am not sure what negative
consequences observing everything would have, though, so I am not
sure where it would show up in Shark and Object Alloc.
Anyone done this, and have real world performance to report? If you
did need to do this, how did you detect which items were visible -
mouseDown?
Targeted hardware ranges from a G3 iBook to a dual 2 G5.
Scott
_______________________________________________
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