|
|
Created:
3 years, 8 months ago by Raphael Kubo da Costa (rakuco) Modified:
3 years, 8 months ago CC:
chromium-reviews, blink-reviews Target Ref:
refs/heads/master Project:
chromium Visibility:
Public. |
Descriptionbindings: Add performance test for JS->WebIDL sequence conversions.
At the moment, we only test it with arrays, as we are still working on the
code to convert arbitrary objects with an @@iterator property into
sequences.
BUG=685754
R=bashi@chromium.org,haraken@chromium.org,yukishiino@chromium.org
Review-Url: https://codereview.chromium.org/2821493002
Cr-Commit-Position: refs/heads/master@{#465207}
Committed: https://chromium.googlesource.com/chromium/src/+/d54885458b5fbe0ea6a3d9997457cef8e12243dd
Patch Set 1 #
Total comments: 3
Patch Set 2 : Push empty strings into the array #Messages
Total messages: 24 (12 generated)
The CQ bit was checked by raphael.kubo.da.costa@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
PTAL. I also have another test for non-arrays, but it needs to land with https://codereview.chromium.org/2810843002 as Blink currently cannot convert them into sequences. I'd prefer to have used window.internals in the test, but it looks like it is not available for the performance tests, so I used Blob instead.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
On 2017/04/13 17:35:54, Raphael Kubo da Costa (rakuco) wrote: > PTAL. > > I also have another test for non-arrays, but it needs to land with > https://codereview.chromium.org/2810843002 as Blink currently cannot convert > them into sequences. > > I'd prefer to have used window.internals in the test, but it looks like it is > not available for the performance tests, so I used Blob instead. Yeah, the performance tests need to run on other browsers, so we don't want to expose window.internals. Just to confirm: The performance of the JS => IDL sequence conversion is dominant in the Blob instantiation, right?
lgtm but please wait for haraken@'s approval. On 2017/04/13 23:00:47, haraken wrote: > On 2017/04/13 17:35:54, Raphael Kubo da Costa (rakuco) wrote: > > PTAL. > > > > I also have another test for non-arrays, but it needs to land with > > https://codereview.chromium.org/2810843002 as Blink currently cannot convert > > them into sequences. > > > > I'd prefer to have used window.internals in the test, but it looks like it is > > not available for the performance tests, so I used Blob instead. > > Yeah, the performance tests need to run on other browsers, so we don't want to > expose window.internals. > > Just to confirm: The performance of the JS => IDL sequence conversion is > dominant in the Blob instantiation, right? In https://codereview.chromium.org/2810843002/#msg9 Raphael said that ~25k runs/second (array) vs ~8k runs/second (iterator) so it's not the case?
LGTM. https://codereview.chromium.org/2821493002/diff/1/third_party/WebKit/Performa... File third_party/WebKit/PerformanceTests/Bindings/sequence-conversion-array.html (right): https://codereview.chromium.org/2821493002/diff/1/third_party/WebKit/Performa... third_party/WebKit/PerformanceTests/Bindings/sequence-conversion-array.html:8: dataArray.push('abcdefg foo bar baz'); Will this v8::String be converted to blink::String or something? If we'd like to measure the pure overhead of v8::Array => IDLSequence, then we wouldn't be interested in the content nor content's conversion. Maybe simple zero or boolean would be better?
On 2017/04/14 00:19:20, bashi wrote: > On 2017/04/13 23:00:47, haraken wrote: > > Just to confirm: The performance of the JS => IDL sequence conversion is > > dominant in the Blob instantiation, right? > > In https://codereview.chromium.org/2810843002/#msg9 Raphael said that ~25k > runs/second (array) vs ~8k runs/second (iterator) so it's not the case? Could you clarify the best way to determine that? Blob::Create() does some additional work that involves iterating over the generated HeapVector later, appending data to internal data structures etc. It also has the overhead of dealing with a union, so each array iteration in the conversion also checks if a given element is of a type other than string. There aren't many options though -- I originally thought of using a Headers instead of a Blob since the additional work done in Headers::Create() is smaller, and could go back to that one.
https://codereview.chromium.org/2821493002/diff/1/third_party/WebKit/Performa... File third_party/WebKit/PerformanceTests/Bindings/sequence-conversion-array.html (right): https://codereview.chromium.org/2821493002/diff/1/third_party/WebKit/Performa... third_party/WebKit/PerformanceTests/Bindings/sequence-conversion-array.html:8: dataArray.push('abcdefg foo bar baz'); On 2017/04/14 07:50:44, Yuki wrote: > Will this v8::String be converted to blink::String or something? > > If we'd like to measure the pure overhead of v8::Array => IDLSequence, then we > wouldn't be interested in the content nor content's conversion. Maybe simple > zero or boolean would be better? Since the string conversion is still going to happen due to Blob's constructor not taking numbers or booleans, how about an empty string instead?
https://codereview.chromium.org/2821493002/diff/1/third_party/WebKit/Performa... File third_party/WebKit/PerformanceTests/Bindings/sequence-conversion-array.html (right): https://codereview.chromium.org/2821493002/diff/1/third_party/WebKit/Performa... third_party/WebKit/PerformanceTests/Bindings/sequence-conversion-array.html:8: dataArray.push('abcdefg foo bar baz'); On 2017/04/14 08:09:10, Raphael Kubo da Costa (rakuco) wrote: > On 2017/04/14 07:50:44, Yuki wrote: > > Will this v8::String be converted to blink::String or something? > > > > If we'd like to measure the pure overhead of v8::Array => IDLSequence, then we > > wouldn't be interested in the content nor content's conversion. Maybe simple > > zero or boolean would be better? > > Since the string conversion is still going to happen due to Blob's constructor > not taking numbers or booleans, how about an empty string instead? An empty string makes sense to me.
On 2017/04/14 08:27:58, Yuki wrote: > An empty string makes sense to me. Done. This also makes the numbers go up -- my latest average is 70.79481642105483 runs/s.
The CQ bit was checked by raphael.kubo.da.costa@intel.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
On 2017/04/14 10:58:57, rakuco (OoO on the 17th) wrote: > On 2017/04/14 08:27:58, Yuki wrote: > > An empty string makes sense to me. > > Done. This also makes the numbers go up -- my latest average is > 70.79481642105483 runs/s. LGTM If Headers does less additional work than Blob, I'd prefer Headers though.
Hmm, I tried using Headers here but the numbers went from 70k/second to ~30k/second, most likely because with Headers we need to perform additional work: dataArray.push('') needs to become dataArray.push(['x', '']), for example. I think I'll land the Blob version.
The CQ bit was checked by raphael.kubo.da.costa@intel.com
The patchset sent to the CQ was uploaded after l-g-t-m from bashi@chromium.org, yukishiino@chromium.org Link to the patchset: https://codereview.chromium.org/2821493002/#ps20001 (title: "Push empty strings into the array")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 20001, "attempt_start_ts": 1492512726454370, "parent_rev": "5047940999a9cf13e8635e61112fdaa7db885726", "commit_rev": "d54885458b5fbe0ea6a3d9997457cef8e12243dd"}
Message was sent while issue was closed.
Description was changed from ========== bindings: Add performance test for JS->WebIDL sequence conversions. At the moment, we only test it with arrays, as we are still working on the code to convert arbitrary objects with an @@iterator property into sequences. BUG=685754 R=bashi@chromium.org,haraken@chromium.org,yukishiino@chromium.org ========== to ========== bindings: Add performance test for JS->WebIDL sequence conversions. At the moment, we only test it with arrays, as we are still working on the code to convert arbitrary objects with an @@iterator property into sequences. BUG=685754 R=bashi@chromium.org,haraken@chromium.org,yukishiino@chromium.org Review-Url: https://codereview.chromium.org/2821493002 Cr-Commit-Position: refs/heads/master@{#465207} Committed: https://chromium.googlesource.com/chromium/src/+/d54885458b5fbe0ea6a3d9997457... ==========
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as https://chromium.googlesource.com/chromium/src/+/d54885458b5fbe0ea6a3d9997457... |