DescriptionCanvas2D 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 #
Messages
Total messages: 17 (2 generated)
|