Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use optimized queue everywhere #18

Merged
merged 4 commits into from
Mar 17, 2019
Merged

Use optimized queue everywhere #18

merged 4 commits into from
Mar 17, 2019

Conversation

MattiasBuelens
Copy link
Owner

  • Switch to Chromium's SimpleQueue implementation for (slightly) better performance and .forEach support.
  • Use SimpleQueue for:
    • ReadableStreamDefaultReader._readRequests
    • ReadableStreamBYOBReader._readIntoRequests
    • ReadableByteStreamController._pendingPullIntos
    • WritableStream._writeRequests

Benchmark before:

> node --prof index.js

web-streams-polyfill testCount(3545) x 742 ops/sec ±2.47% (79 runs sampled) (period: 1.35ms)
web-streams-polyfill testCount(7090) x 362 ops/sec ±1.06% (80 runs sampled) (period: 2.76ms)
web-streams-polyfill testCount(14180) x 167 ops/sec ±1.25% (75 runs sampled) (period: 6.00ms)
web-streams-polyfill testCount(28360) x 73.14 ops/sec ±0.43% (81 runs sampled) (period: 13.67ms)
web-streams-polyfill testCount(56720) x 23.82 ops/sec ±4.17% (57 runs sampled) (period: 41.97ms)
web-streams-polyfill testCount(113440) x 11.08 ops/sec ±0.95% (54 runs sampled) (period: 90.26ms)

Benchmark after:

> node --prof index.js

web-streams-polyfill testCount(3545) x 972 ops/sec ±1.05% (80 runs sampled) (period: 1.03ms)
web-streams-polyfill testCount(7090) x 460 ops/sec ±1.28% (82 runs sampled) (period: 2.17ms)
web-streams-polyfill testCount(14180) x 209 ops/sec ±1.12% (78 runs sampled) (period: 4.79ms)
web-streams-polyfill testCount(28360) x 87.96 ops/sec ±0.51% (79 runs sampled) (period: 11.37ms)
web-streams-polyfill testCount(56720) x 26.73 ops/sec ±4.14% (63 runs sampled) (period: 37.41ms)
web-streams-polyfill testCount(113440) x 12.54 ops/sec ±0.80% (60 runs sampled) (period: 79.73ms)

@MattiasBuelens MattiasBuelens added this to the v2.0.2 milestone Mar 17, 2019
@MattiasBuelens MattiasBuelens added the domain: performance Issues related to slow performance or high memory usage label Mar 17, 2019
@MattiasBuelens MattiasBuelens merged commit 7706fe5 into master Mar 17, 2019
@MattiasBuelens MattiasBuelens deleted the more-queues branch March 17, 2019 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: performance Issues related to slow performance or high memory usage enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant