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

Issue 1974713003: Speed up fix for expando-loss conformance test. (Closed)

Created:
4 years, 7 months ago by Ken Russell (switch to Gerrit)
Modified:
4 years, 7 months ago
CC:
chromium-reviews, blink-reviews, blink-reviews-bindings_chromium.org, sof
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Speed up fix for expando-loss conformance test. The previously-added preserveObjectWrapper was spending a lot of time in string allocation and concatenation. Reimplement it using multiple object arrays attached to the JavaScript wrappers, and simple indexing into those arrays. Also, maintain a weak persistent cache of these arrays in the containing objects (the context, programs, framebufffers, etc.) to avoid lookups via V8HiddenValue::getHiddenValue. (This call is expensive; see below.) On a Linux desktop workstation testing a Release component build, this speeds up the WebGL animometer benchmark(*) running with a fixed load of 10000 triangles from 71 ms/frame to 37 ms/frame. For comparison, with the preserveObjectWrapper calls completely removed, the benchmark runs at 23 ms/frame. Without the persistent cache, calling V8HiddenValue::getHiddenValue each time, the benchmark runs at 55 ms/frame. (*) ./tools/perf/run_benchmark --browser=release smoothness.tough_webgl_cases BUG=608576 CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel Committed: https://crrev.com/9a21ed3eab013d0240f38bea0c55b9acc10dc864 Cr-Commit-Position: refs/heads/master@{#393737}

Patch Set 1 #

Total comments: 10

Patch Set 2 : Address haraken's review feedback. Use V8_CALL. #

Patch Set 3 : Address review feedback from haraken. Use phantom persistents. #

Total comments: 2

Patch Set 4 : Use v8CallOrCrash. Add V8HiddenValue::getHiddenValue TODO. #

Patch Set 5 : Fixed Windows compile errors. #

Patch Set 6 : Add V8CopyablePersistent alias to avoid incorrect usage. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+149 lines, -53 lines) Patch
M third_party/WebKit/Source/bindings/core/v8/V8HiddenValue.h View 1 2 3 1 chunk +9 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp View 2 chunks +6 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.h View 1 2 3 4 5 2 chunks +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp View 1 2 3 4 5 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLObject.h View 1 2 3 4 5 1 chunk +12 lines, -0 lines 1 comment Download
M third_party/WebKit/Source/modules/webgl/WebGLProgram.h View 1 2 3 4 5 2 chunks +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLProgram.cpp View 1 2 3 4 5 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h View 1 2 3 4 5 2 chunks +23 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp View 1 2 3 4 5 16 chunks +70 lines, -47 lines 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLVertexArrayObjectBase.h View 1 2 3 4 5 2 chunks +6 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLVertexArrayObjectBase.cpp View 1 2 3 4 5 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 47 (18 generated)
Ken Russell (switch to Gerrit)
zmo: please review. haraken, sigbjornf: FYI, in case you'd like to look over the use ...
4 years, 7 months ago (2016-05-12 21:26:17 UTC) #3
Zhenyao Mo
On 2016/05/12 21:26:17, Ken Russell wrote: > zmo: please review. > > haraken, sigbjornf: FYI, ...
4 years, 7 months ago (2016-05-12 21:40:05 UTC) #4
Ken Russell (switch to Gerrit)
On 2016/05/12 21:40:05, Zhenyao Mo wrote: > On 2016/05/12 21:26:17, Ken Russell wrote: > > ...
4 years, 7 months ago (2016-05-12 21:54:52 UTC) #7
esprehn
Can you benchmark without dcheck turned on? That makes many things very slow.
4 years, 7 months ago (2016-05-12 22:10:00 UTC) #8
haraken
https://codereview.chromium.org/1974713003/diff/1/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/1974713003/diff/1/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode6311 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:6311: v8::Maybe<bool> result = persistentCache->Get(isolate)->Set( Avoid using Maybe APIs -- ...
4 years, 7 months ago (2016-05-13 01:32:41 UTC) #9
haraken
On 2016/05/12 22:10:00, esprehn wrote: > Can you benchmark without dcheck turned on? That makes ...
4 years, 7 months ago (2016-05-13 01:33:10 UTC) #10
esprehn
On 2016/05/13 at 01:33:10, haraken wrote: > On 2016/05/12 22:10:00, esprehn wrote: > > Can ...
4 years, 7 months ago (2016-05-13 01:35:27 UTC) #11
Ken Russell (switch to Gerrit)
https://codereview.chromium.org/1974713003/diff/1/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/1974713003/diff/1/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode6311 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:6311: v8::Maybe<bool> result = persistentCache->Get(isolate)->Set( On 2016/05/13 01:32:41, haraken wrote: ...
4 years, 7 months ago (2016-05-13 01:45:35 UTC) #12
Ken Russell (switch to Gerrit)
On 2016/05/12 22:10:00, esprehn wrote: > Can you benchmark without dcheck turned on? That makes ...
4 years, 7 months ago (2016-05-13 01:53:32 UTC) #14
Ken Russell (switch to Gerrit)
https://codereview.chromium.org/1974713003/diff/1/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/1974713003/diff/1/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode6311 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:6311: v8::Maybe<bool> result = persistentCache->Get(isolate)->Set( On 2016/05/13 01:45:35, Ken Russell ...
4 years, 7 months ago (2016-05-13 02:10:14 UTC) #15
haraken
https://codereview.chromium.org/1974713003/diff/1/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/1974713003/diff/1/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode6287 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:6287: static void NoopWeakCallback(const v8::WeakCallbackInfo<int>& data) You can use a ...
4 years, 7 months ago (2016-05-13 02:12:20 UTC) #16
Ken Russell (switch to Gerrit)
https://codereview.chromium.org/1974713003/diff/1/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/1974713003/diff/1/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode6287 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:6287: static void NoopWeakCallback(const v8::WeakCallbackInfo<int>& data) On 2016/05/13 02:12:20, haraken ...
4 years, 7 months ago (2016-05-13 02:24:30 UTC) #17
esprehn
Your description still says dcheck was on?
4 years, 7 months ago (2016-05-13 03:00:40 UTC) #18
Ken Russell (switch to Gerrit)
On 2016/05/13 03:00:40, esprehn wrote: > Your description still says dcheck was on? Oops, sorry, ...
4 years, 7 months ago (2016-05-13 03:07:29 UTC) #20
haraken
+jochen: FYI, V8HiddenValue::getHiddenValue is slow so we need to manually cache the contents of the ...
4 years, 7 months ago (2016-05-13 04:27:39 UTC) #22
haraken
LGTM https://codereview.chromium.org/1974713003/diff/40001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/1974713003/diff/40001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode6307 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:6307: V8_CALL(result, localCache, Set(scriptState->context(), index, targetObject->newLocalWrapper(isolate)), return); v8CallOrCrash https://codereview.chromium.org/1974713003/diff/40001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode6311 ...
4 years, 7 months ago (2016-05-13 04:33:00 UTC) #23
Ken Russell (switch to Gerrit)
On 2016/05/13 04:27:39, haraken wrote: > +jochen: FYI, V8HiddenValue::getHiddenValue is slow so we need to ...
4 years, 7 months ago (2016-05-13 21:23:42 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1974713003/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1974713003/60001
4 years, 7 months ago (2016-05-13 21:56:53 UTC) #28
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/221579) win_chromium_x64_rel_ng on tryserver.chromium.win (JOB_FAILED, ...
4 years, 7 months ago (2016-05-13 22:59:20 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1974713003/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1974713003/80001
4 years, 7 months ago (2016-05-13 23:17:32 UTC) #33
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/228875)
4 years, 7 months ago (2016-05-14 00:43:10 UTC) #35
Ken Russell (switch to Gerrit)
On 2016/05/14 00:43:10, commit-bot: I haz the power wrote: > Try jobs failed on following ...
4 years, 7 months ago (2016-05-14 01:24:26 UTC) #36
Ken Russell (switch to Gerrit)
On 2016/05/14 01:24:26, Ken Russell wrote: > On 2016/05/14 00:43:10, commit-bot: I haz the power ...
4 years, 7 months ago (2016-05-14 02:51:21 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1974713003/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1974713003/100001
4 years, 7 months ago (2016-05-14 02:51:38 UTC) #40
haraken
If this CL is not urgent, I want to reconsider the approach on Monday. We've ...
4 years, 7 months ago (2016-05-14 02:56:40 UTC) #41
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 7 months ago (2016-05-14 20:26:05 UTC) #43
commit-bot: I haz the power
Patchset 6 (id:??) landed as https://crrev.com/9a21ed3eab013d0240f38bea0c55b9acc10dc864 Cr-Commit-Position: refs/heads/master@{#393737}
4 years, 7 months ago (2016-05-14 20:27:30 UTC) #45
haraken
https://codereview.chromium.org/1974713003/diff/100001/third_party/WebKit/Source/modules/webgl/WebGLObject.h File third_party/WebKit/Source/modules/webgl/WebGLObject.h (right): https://codereview.chromium.org/1974713003/diff/100001/third_party/WebKit/Source/modules/webgl/WebGLObject.h#newcode69 third_party/WebKit/Source/modules/webgl/WebGLObject.h:69: using V8CopyablePersistent = v8::Persistent<T, v8::CopyablePersistentTraits<T>>; Instead you should use ...
4 years, 7 months ago (2016-05-15 09:18:46 UTC) #46
Ken Russell (switch to Gerrit)
4 years, 7 months ago (2016-05-17 00:26:58 UTC) #47
Message was sent while issue was closed.
On 2016/05/15 09:18:46, haraken wrote:
>
https://codereview.chromium.org/1974713003/diff/100001/third_party/WebKit/Sou...
> File third_party/WebKit/Source/modules/webgl/WebGLObject.h (right):
> 
>
https://codereview.chromium.org/1974713003/diff/100001/third_party/WebKit/Sou...
> third_party/WebKit/Source/modules/webgl/WebGLObject.h:69: using
> V8CopyablePersistent = v8::Persistent<T, v8::CopyablePersistentTraits<T>>;
> 
> Instead you should use ScopedPersistent. Then ScopedPersistent's destructor
> resets the underlying persistent handle, which will solve the problem.

Thanks. Making this change in https://codereview.chromium.org/1983953002 .

Powered by Google App Engine
This is Rietveld 408576698