On Mar 2, 2015, at 8:54 AM, Ben <[email protected]> wrote:
> From a time profile, the majority of my code being called is funnelled > through a single method which handles the adding/positioning/removing of > views within the visible area. The slow areas are: > > 8% - Instantiating new views (happens early on, views are cached for reuse) > 20% - Positioning new/reused views (a single -setFrame: call once for each > view) > 25% - Adding newly-visible subviews (-addSubview:) > 17% - Enumerating off-screen columns for view removal > (-removeFromSuperviewWithoutNeedingDisplay) > 25% - Enumerating off-screen rows for view removal > (-removeFromSuperviewWithoutNeedingDisplay) > Remainder is misc small stuff. This method as a whole takes 19% of running > time. What are you considering "visible" or "the visible area"? For responsive scrolling, you don't want to limit it to the document view's visible rect. You want to use the preparedContentRect and override -prepareContentInRect: to be told when that is changing. Review this list of the "secondary" requirements to participate in responsive scrolling, from the AppKit release notes for 10.9 (not currently available online): The list of secondary requirements are: * Do not override -scrollWheel: in an NSScrollView, NSClipView subclass, or in the document view. (See the event modal notes in this section) * Do not override -drawRect: in an NSScrollView subclass * Do not override -lockFocus: in an NSScrollView, NSClipView subclass, or in the document view. Layer backed secondary requirements: * The root layer must be either the NSScrollView or an ancestor view Traditional drawing secondary requirements: * copiesOnScroll must be set to YES on the NSClipView * The documentView must override -isOpaque and return YES Regards, Ken _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
