Bug 184990 - Web Inspector: Canvas tab: Determine isFunction by looking at the prototype
Summary: Web Inspector: Canvas tab: Determine isFunction by looking at the prototype
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on: 182995
Blocks: WebInspectorCanvasRecording
  Show dependency treegraph
 
Reported: 2018-04-25 12:51 PDT by Devin Rousso
Modified: 2018-05-04 11:52 PDT (History)
6 users (show)

See Also:


Attachments
Patch (8.25 KB, patch)
2018-04-25 12:57 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-sierra (2.55 MB, application/zip)
2018-05-01 17:46 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews106 for mac-sierra-wk2 (3.34 MB, application/zip)
2018-05-01 18:26 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews114 for mac-sierra (3.18 MB, application/zip)
2018-05-01 19:23 PDT, EWS Watchlist
no flags Details
Patch (9.81 KB, patch)
2018-05-01 22:02 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews200 for win-future (12.87 MB, application/zip)
2018-05-02 00:36 PDT, EWS Watchlist
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2018-04-25 12:51:17 PDT
Instead of maintaining a static list of function calls on the different canvas context types, we can just look at the prototype to determine if a given key resolves to a function.
Comment 1 Devin Rousso 2018-04-25 12:57:34 PDT
Created attachment 338771 [details]
Patch
Comment 2 EWS Watchlist 2018-05-01 17:46:29 PDT Comment hidden (obsolete)
Comment 3 EWS Watchlist 2018-05-01 17:46:30 PDT Comment hidden (obsolete)
Comment 4 EWS Watchlist 2018-05-01 18:26:39 PDT Comment hidden (obsolete)
Comment 5 EWS Watchlist 2018-05-01 18:26:40 PDT Comment hidden (obsolete)
Comment 6 EWS Watchlist 2018-05-01 19:23:45 PDT Comment hidden (obsolete)
Comment 7 EWS Watchlist 2018-05-01 19:23:46 PDT Comment hidden (obsolete)
Comment 8 Devin Rousso 2018-05-01 22:02:24 PDT
Created attachment 339276 [details]
Patch
Comment 9 EWS Watchlist 2018-05-02 00:36:17 PDT Comment hidden (obsolete)
Comment 10 EWS Watchlist 2018-05-02 00:36:29 PDT Comment hidden (obsolete)
Comment 11 Devin Rousso 2018-05-02 00:49:02 PDT
Comment on attachment 339287 [details]
Archive of layout-test-results from ews200 for win-future

Unrelated failure
Comment 12 BJ Burg 2018-05-03 09:27:34 PDT
Comment on attachment 339276 [details]
Patch

r=me

How often is this code called? Does it affect performance to dynamically look up for every call, rather than using a fixed Set lookup?
Comment 13 Devin Rousso 2018-05-03 16:17:17 PDT
(In reply to Brian Burg from comment #12)
> How often is this code called? Does it affect performance to dynamically
> look up for every call, rather than using a fixed Set lookup?
`WI.RecoringAction.isFunctionForType` is called once per `WI.RecordingAction` (assuming it has been `swizzle()`d), and is called for each value in the `WI.Recording`'s `initialState.attributes`.  I think a good middle-ground would be to keep the `WI.RecordingAction._functionNames` object, but have it be filled with values as each action is processed (sort of like a memoization).
Comment 14 BJ Burg 2018-05-03 16:52:44 PDT
(In reply to Devin Rousso from comment #13)
> (In reply to Brian Burg from comment #12)
> > How often is this code called? Does it affect performance to dynamically
> > look up for every call, rather than using a fixed Set lookup?
> `WI.RecoringAction.isFunctionForType` is called once per
> `WI.RecordingAction` (assuming it has been `swizzle()`d), and is called for
> each value in the `WI.Recording`'s `initialState.attributes`.  I think a
> good middle-ground would be to keep the `WI.RecordingAction._functionNames`
> object, but have it be filled with values as each action is processed (sort
> of like a memoization).

If you can capture a profile during the initial setup, and you can't see this code, then don't bother optimizing it.
Comment 15 Devin Rousso 2018-05-04 11:23:31 PDT
(In reply to Brian Burg from comment #14)
> (In reply to Devin Rousso from comment #13)
> > (In reply to Brian Burg from comment #12)
> > > How often is this code called? Does it affect performance to dynamically
> > > look up for every call, rather than using a fixed Set lookup?
> > `WI.RecoringAction.isFunctionForType` is called once per
> > `WI.RecordingAction` (assuming it has been `swizzle()`d), and is called for
> > each value in the `WI.Recording`'s `initialState.attributes`.  I think a
> > good middle-ground would be to keep the `WI.RecordingAction._functionNames`
> > object, but have it be filled with values as each action is processed (sort
> > of like a memoization).
> 
> If you can capture a profile during the initial setup, and you can't see
> this code, then don't bother optimizing it.
I was able to get a profile of it while recording the canvas on <http://acko.net> and it only took 0.1ms.  The worst I've seen so far (100k actions) was 0.9ms.  I think it's fine as is.
Comment 16 WebKit Commit Bot 2018-05-04 11:50:36 PDT
Comment on attachment 339276 [details]
Patch

Clearing flags on attachment: 339276

Committed r231368: <https://trac.webkit.org/changeset/231368>
Comment 17 WebKit Commit Bot 2018-05-04 11:50:38 PDT
All reviewed patches have been landed.  Closing bug.
Comment 18 Radar WebKit Bug Importer 2018-05-04 11:52:35 PDT
<rdar://problem/39984315>