To recap where we left off on Sept 19, the issue is that when an item in an 
NSOutlineView is expanded, its data source receives 
-outlineView:child:ofObject: once for *every* child, even if the item has 
20,000 children but only 20 can fit in the window, causing poor performance if 
getting the child has a significant cost.

A workaround is to make the data source “lazy”.  Method 
-outlineView:child:ofObject: should create and return a proxy object containing 
only the passed-in ‘child' and ‘object’ parameters, while the other three 
NSOutlineViewDataSource methods, which AppKit invokes lazily, get this proxy 
and do the heavy lifting of fetching or filtering the actual item from the data 
model.

I’ve modified the demo project to show both “dumb” and “lazy” data sources.

https://github.com/jerrykrinock/NSOutlineViewLazinessDemo


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to