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

Issue 2637863002: Fix ReadableStream scalability issue (Closed)

Created:
3 years, 11 months ago by Adam Rice
Modified:
3 years, 11 months ago
Reviewers:
yhirano
CC:
chromium-reviews, blink-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix ReadableStream scalability issue ReadableStream becomes very slow when 56720 or more chunks are in the queue. Instead of one InternalPackedArray as the queue, use a single-linked list of InternalPackedArrays. If adding a chunk would cause the array at the back to grow to more than 16384 chunks, add a new node to the list instead. The new Queue class hasn't had any particular optimisation, but informal benchmarks show it slightly slower for small queues, faster for medium-size queues and drastically faster where the old implementation fell off the performance cliff. Thanks to Jakob Kummerow for suggesting the cursor mechanism: https://groups.google.com/d/msg/v8-users/Hj78A4yhQS4/edz6-NsyCAAJ Alternatives considered: * Array-backed circular buffer. Rejected because it would cause additional overhead in the case of a small queue. * Polymorphically switching between old and new queue representations at some threshold. Rejected for complexity. BUG=681493 Review-Url: https://codereview.chromium.org/2637863002 Cr-Commit-Position: refs/heads/master@{#445717} Committed: https://chromium.googlesource.com/chromium/src/+/9106f36b383c3e366fa8bb9db1c5b9b1c426491a

Patch Set 1 #

Total comments: 2

Patch Set 2 : Use cursor in Queue. Use Queue for [[readRequests]] slot. #

Total comments: 4

Patch Set 3 : Remove unreachable code and use constant #

Unified diffs Side-by-side diffs Delta from patch set Stats (+77 lines, -15 lines) Patch
M third_party/WebKit/Source/core/streams/ReadableStream.js View 1 2 7 chunks +77 lines, -15 lines 0 comments Download

Messages

Total messages: 27 (16 generated)
Adam Rice
+yhirano, could you take a look at this? I want to validate that the approach ...
3 years, 11 months ago (2017-01-17 03:58:29 UTC) #2
yhirano
looks good. https://codereview.chromium.org/2637863002/diff/1/third_party/WebKit/Source/core/streams/ReadableStream.js File third_party/WebKit/Source/core/streams/ReadableStream.js (right): https://codereview.chromium.org/2637863002/diff/1/third_party/WebKit/Source/core/streams/ReadableStream.js#newcode812 third_party/WebKit/Source/core/streams/ReadableStream.js:812: get length() { How about having |empty| ...
3 years, 11 months ago (2017-01-17 08:23:37 UTC) #3
Adam Rice
https://codereview.chromium.org/2637863002/diff/1/third_party/WebKit/Source/core/streams/ReadableStream.js File third_party/WebKit/Source/core/streams/ReadableStream.js (right): https://codereview.chromium.org/2637863002/diff/1/third_party/WebKit/Source/core/streams/ReadableStream.js#newcode812 third_party/WebKit/Source/core/streams/ReadableStream.js:812: get length() { On 2017/01/17 08:23:37, yhirano wrote: > ...
3 years, 11 months ago (2017-01-17 08:33:40 UTC) #4
yhirano
lgtm
3 years, 11 months ago (2017-01-17 10:10:05 UTC) #7
Adam Rice
yhirano: I'm ready to submit. PTAL at PS2.
3 years, 11 months ago (2017-01-19 12:23:38 UTC) #12
Adam Rice
On 2017/01/19 12:23:38, Adam Rice wrote: > yhirano: I'm ready to submit. PTAL at PS2. ...
3 years, 11 months ago (2017-01-24 10:14:57 UTC) #15
yhirano
Sorry! https://codereview.chromium.org/2637863002/diff/20001/third_party/WebKit/Source/core/streams/ReadableStream.js File third_party/WebKit/Source/core/streams/ReadableStream.js (right): https://codereview.chromium.org/2637863002/diff/20001/third_party/WebKit/Source/core/streams/ReadableStream.js#newcode814 third_party/WebKit/Source/core/streams/ReadableStream.js:814: if (this.back.elements.length === 16384) { [optional] Having a ...
3 years, 11 months ago (2017-01-24 11:14:13 UTC) #16
Adam Rice
https://codereview.chromium.org/2637863002/diff/20001/third_party/WebKit/Source/core/streams/ReadableStream.js File third_party/WebKit/Source/core/streams/ReadableStream.js (right): https://codereview.chromium.org/2637863002/diff/20001/third_party/WebKit/Source/core/streams/ReadableStream.js#newcode814 third_party/WebKit/Source/core/streams/ReadableStream.js:814: if (this.back.elements.length === 16384) { On 2017/01/24 11:14:13, yhirano ...
3 years, 11 months ago (2017-01-24 12:33:02 UTC) #17
yhirano
lgtm
3 years, 11 months ago (2017-01-24 12:37:18 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2637863002/40001
3 years, 11 months ago (2017-01-24 13:56:48 UTC) #24
commit-bot: I haz the power
3 years, 11 months ago (2017-01-24 14:28:15 UTC) #27
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://chromium.googlesource.com/chromium/src/+/9106f36b383c3e366fa8bb9db1c5...

Powered by Google App Engine
This is Rietveld 408576698