Bug 132790

Summary: Implement -forwardingTargetForSelector on WKScrollViewDelegateForwarder
Product: WebKit Reporter: Tim Horton <thorton>
Component: WebKit2Assignee: Tim Horton <thorton>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, mitz, sam, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
mitz: review+
patch mitz: review+

Description Tim Horton 2014-05-10 16:53:29 PDT
This is a ~4.3% win on UI process total time (5%->0.7%) running http://www.kevs3d.co.uk/dev/canvasmark/, as predicted by https://bugs.webkit.org/show_bug.cgi?id=127085#c2.
Comment 1 Radar WebKit Bug Importer 2014-05-10 16:53:47 PDT
<rdar://problem/16877802>
Comment 2 Tim Horton 2014-05-10 20:15:27 PDT
Created attachment 231244 [details]
patch
Comment 3 mitz 2014-05-10 20:20:15 PDT
Comment on attachment 231244 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=231244&action=review

> Source/WebKit2/UIProcess/ios/WKScrollView.mm:91
> +    BOOL internalDelegateWillRespond = [_internalDelegate respondsToSelector:aSelector];
> +    BOOL externalDelegateWillRespond = [_externalDelegate respondsToSelector:aSelector];

We could make things even faster by caching these for some or all selectors.

> Source/WebKit2/UIProcess/ios/WKScrollView.mm:97
> +    return self;

The documentation for -forwardingTargetForSelector: says
    (Obviously if you return self from this method, the code would just fall into an infinite loop.)
Why are you returning self?
Comment 4 Tim Horton 2014-05-10 20:24:22 PDT
(In reply to comment #3)
> (From update of attachment 231244 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=231244&action=review
> 
> > Source/WebKit2/UIProcess/ios/WKScrollView.mm:91
> > +    BOOL internalDelegateWillRespond = [_internalDelegate respondsToSelector:aSelector];
> > +    BOOL externalDelegateWillRespond = [_externalDelegate respondsToSelector:aSelector];
> 
> We could make things even faster by caching these for some or all selectors.
> 
> > Source/WebKit2/UIProcess/ios/WKScrollView.mm:97
> > +    return self;
> 
> The documentation for -forwardingTargetForSelector: says
>     (Obviously if you return self from this method, the code would just fall into an infinite loop.)
> Why are you returning self?

Ha! I missed that, and misunderstood the fallback case. Also that suggests to me that we never run into this case, because I haven't seen any infinite loops yet today :D
Comment 5 Tim Horton 2014-05-10 20:31:18 PDT
Created attachment 231246 [details]
patch
Comment 6 Tim Horton 2014-05-10 20:33:25 PDT
http://trac.webkit.org/changeset/168593