Bug 132790 - Implement -forwardingTargetForSelector on WKScrollViewDelegateForwarder
Summary: Implement -forwardingTargetForSelector on WKScrollViewDelegateForwarder
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-05-10 16:53 PDT by Tim Horton
Modified: 2014-05-10 20:33 PDT (History)
5 users (show)

See Also:


Attachments
patch (1.65 KB, patch)
2014-05-10 20:15 PDT, Tim Horton
mitz: review+
Details | Formatted Diff | Diff
patch (1.65 KB, patch)
2014-05-10 20:31 PDT, Tim Horton
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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