Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1199)

Issue 608853008: Canvas2D Performance: fix the bottleneck of hasInstance in JS binding -- TypeChecking Interface (Closed)

Created:
6 years, 2 months ago by yunchao
Modified:
6 years, 2 months ago
Reviewers:
haraken, Jens Widell
CC:
blink-reviews, blink-reviews-bindings_chromium.org, arv+blink
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Canvas2D Performance: fix the bottleneck of hasInstance in JS binding -- TypeChecking Interface If web app invokes hundreds of drawImage per frame, hasInstance(called by drawImageMethod) will become a bottleneck. Here is test data from content shell on Nexus7 by Linux perf tool: benchmark ratio that hasInstance costs in the whole renderer my local benchmark(draw 1000 sprites) 6.9% speedReading 4.4% FishIETank(1000 fishes) 2.6% GUIMark3 Bitmap 4.0% drawImageMethod is in out/Release/gen/blink/bindings/core/v8/V8CanvasRenderingContext2D.cpp, which is an auto-generated file. It will call hasInstance(eg V8HTMLImageElement::hasInstance) 3 times for every call to drawImage. One is in drawImageMethod directly, the other two are in drawImage*Method, say drawImage1Method. The 3rd call site is redundant if type check has been done by typechecking interface. This change removes the 3rd call of hasInstance in drawImageMethod to fix the performance bottleneck. It also benefits similar cases during JS binding. This change can improves performance and/or saves power. BUG=416393 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=183536

Patch Set 1 #

Total comments: 9

Patch Set 2 : update code (coding style, naming, etc) according to reviers's suggestion #

Patch Set 3 : still use toImplWithTypeCheck for nullable arguments for [TypeChecking] methods #

Total comments: 2

Patch Set 4 : still call toImplWithTypeCheck for undefined arguments + test cases in TestObject.idl #

Total comments: 7

Patch Set 5 : update code according to Jens's suggestions #

Unified diffs Side-by-side diffs Delta from patch set Stats (+130 lines, -15 lines) Patch
M Source/bindings/scripts/v8_methods.py View 1 2 3 4 4 chunks +15 lines, -7 lines 0 comments Download
M Source/bindings/scripts/v8_types.py View 1 4 chunks +7 lines, -4 lines 0 comments Download
M Source/bindings/tests/idls/core/TestObject.idl View 1 2 3 4 1 chunk +4 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestInterface.cpp View 1 2 chunks +2 lines, -2 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestObject.cpp View 1 2 3 4 3 chunks +101 lines, -1 line 0 comments Download
M Source/bindings/tests/results/modules/V8TestInterface5.cpp View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 17 (2 generated)
yunchao
PTAL, thanks a lot. Please see the discussion in https://codereview.chromium.org/611953003/
6 years, 2 months ago (2014-10-02 11:11:22 UTC) #2
haraken
LGTM https://codereview.chromium.org/608853008/diff/1/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/608853008/diff/1/Source/bindings/scripts/v8_methods.py#newcode213 Source/bindings/scripts/v8_methods.py:213: 'has_type_checking_interface': type_checking_interface, Can we rename this to needs_type_check ...
6 years, 2 months ago (2014-10-02 11:52:57 UTC) #3
Jens Widell
On 2014/10/02 11:52:57, haraken wrote: > LGTM not lgtm (Sorry, I have draft comments. Am ...
6 years, 2 months ago (2014-10-02 11:55:27 UTC) #4
Jens Widell
https://codereview.chromium.org/608853008/diff/1/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/608853008/diff/1/Source/bindings/scripts/v8_methods.py#newcode194 Source/bindings/scripts/v8_methods.py:194: type_checking_interface = (has_extended_attribute_value(interface, 'TypeChecking', 'Interface') or has_extended_attribute_value(method, 'TypeChecking', 'Interface')) ...
6 years, 2 months ago (2014-10-02 12:18:14 UTC) #5
haraken
On 2014/10/02 11:55:27, Jens Widell wrote: > On 2014/10/02 11:52:57, haraken wrote: > > LGTM ...
6 years, 2 months ago (2014-10-02 13:04:46 UTC) #6
yunchao
Hi jl@ and haraken@, I have update the code accordingly. Please take a look. Thanks ...
6 years, 2 months ago (2014-10-08 07:04:58 UTC) #7
Jens Widell
https://codereview.chromium.org/608853008/diff/1/Source/bindings/scripts/v8_types.py File Source/bindings/scripts/v8_types.py (right): https://codereview.chromium.org/608853008/diff/1/Source/bindings/scripts/v8_types.py#newcode537 Source/bindings/scripts/v8_types.py:537: 'V8{idl_type}::toImpl(v8::Handle<v8::Object>::Cast({v8_value}))') On 2014/10/08 07:04:58, yunchao wrote: > On 2014/10/02 ...
6 years, 2 months ago (2014-10-08 08:11:13 UTC) #8
yunchao
I updated the code again, please take a look. Thanks a lot! https://codereview.chromium.org/608853008/diff/1/Source/bindings/scripts/v8_types.py File Source/bindings/scripts/v8_types.py ...
6 years, 2 months ago (2014-10-08 11:23:24 UTC) #9
Jens Widell
It would be great if you also added to TestObject.idl two additional [TypeChecking=Interface] methods, one ...
6 years, 2 months ago (2014-10-08 11:51:26 UTC) #10
yunchao
Thanks for your review, Jens. As you suggested, test cases are added into TestObject.idl. Please ...
6 years, 2 months ago (2014-10-09 04:54:07 UTC) #11
Jens Widell
LGTM, with a few nits. https://codereview.chromium.org/608853008/diff/60001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/608853008/diff/60001/Source/bindings/scripts/v8_methods.py#newcode201 Source/bindings/scripts/v8_methods.py:201: not idl_type.is_nullable and Nit: ...
6 years, 2 months ago (2014-10-10 09:26:02 UTC) #12
yunchao
Thanks for your review, Jens. I have updated the code accordingly except one. https://codereview.chromium.org/608853008/diff/60001/Source/bindings/scripts/v8_methods.py File ...
6 years, 2 months ago (2014-10-10 10:36:11 UTC) #13
Jens Widell
https://codereview.chromium.org/608853008/diff/60001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/608853008/diff/60001/Source/bindings/scripts/v8_methods.py#newcode222 Source/bindings/scripts/v8_methods.py:222: 'has_type_checking_interface': type_checking_interface, On 2014/10/10 10:36:11, yunchao wrote: > On ...
6 years, 2 months ago (2014-10-10 10:44:14 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/608853008/100001
6 years, 2 months ago (2014-10-10 10:47:05 UTC) #16
commit-bot: I haz the power
6 years, 2 months ago (2014-10-10 11:47:52 UTC) #17
Message was sent while issue was closed.
Committed patchset #5 (id:100001) as 183536

Powered by Google App Engine
This is Rietveld 408576698