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

stream: improve read() performance #29337

Merged
merged 1 commit into from Aug 31, 2019

Conversation

@mscdex
Copy link
Contributor

commented Aug 27, 2019

Benchmark results:

                                                        confidence improvement accuracy (*)    (**)   (***)
 streams/readable-bigread.js n=1000                           ***      9.17 %       ±0.96%  ±1.28%  ±1.66%
 streams/readable-unevenread.js n=1000                        ***      5.02 %       ±1.06%  ±1.41%  ±1.84%
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
@nodejs-github-bot

This comment has been minimized.

@Fishrock123
Copy link
Member

left a comment

This code is frankly quite difficult to understand, but I think this is correct.

lib/internal/streams/buffer_list.js Show resolved Hide resolved
@nodejs-github-bot

This comment has been minimized.

@Trott

This comment has been minimized.

Copy link
Member

commented Aug 29, 2019

@mcollina
Copy link
Member

left a comment

LGTM, good work! A CITGM run would be helpful to assess any breakage.

@mscdex

This comment has been minimized.

Copy link
Contributor Author

commented Aug 29, 2019

@mcollina What breakage? These changes consist of:

  • Replacing src.copy() with dest.set() (like was done in one of my recent streams perf PRs)

  • Folding the copy of the first list item into the loop

  • Avoiding unnecessary calculations once we've reached the last buffer in the list used to fill ret

@mcollina

This comment has been minimized.

Copy link
Member

commented Aug 30, 2019

I'm skeptical of any side effect a change in streams can have at this point, so a run would not be a waste of time.

CITGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1987/

@mcollina

This comment has been minimized.

Copy link
Member

commented Aug 30, 2019

I don't see anything suspicious on CITGM, LGTM from me.

stream: improve read() performance
PR-URL: #29337
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>

@mscdex mscdex force-pushed the mscdex:stream-read-perf branch from 172edd9 to 98b7185 Aug 31, 2019

@mscdex mscdex merged commit 98b7185 into nodejs:master Aug 31, 2019

1 check passed

Travis CI - Branch Build Passed
Details

@mscdex mscdex deleted the mscdex:stream-read-perf branch Aug 31, 2019

BridgeAR added a commit that referenced this pull request Sep 3, 2019
stream: improve read() performance
PR-URL: #29337
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
@BridgeAR BridgeAR referenced this pull request Sep 3, 2019
BridgeAR added a commit that referenced this pull request Sep 4, 2019
stream: improve read() performance
PR-URL: #29337
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
JeniaBR added a commit to JeniaBR/node that referenced this pull request Sep 11, 2019
stream: improve read() performance
PR-URL: nodejs#29337
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
JeniaBR added a commit to JeniaBR/node that referenced this pull request Sep 11, 2019
stream: improve read() performance
PR-URL: nodejs#29337
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.