Skip to content

buffer: improve copy() performance#29066

Closed
mscdex wants to merge 1 commit into
nodejs:masterfrom
mscdex:buffer-copy-perf
Closed

buffer: improve copy() performance#29066
mscdex wants to merge 1 commit into
nodejs:masterfrom
mscdex:buffer-copy-perf

Conversation

@mscdex

@mscdex mscdex commented Aug 9, 2019

Copy link
Copy Markdown
Contributor

Results of included benchmark:

                                                               confidence improvement accuracy (*)   (**)   (***)
 buffers/buffer-copy.js n=6000000 partial='false' bytes=0            ***    580.96 %       ±3.05% ±4.06%  ±5.30%
 buffers/buffer-copy.js n=6000000 partial='false' bytes=8            ***    179.90 %       ±5.71% ±7.69% ±10.20%
 buffers/buffer-copy.js n=6000000 partial='false' bytes=128          ***    174.81 %       ±1.17% ±1.56%  ±2.05%
 buffers/buffer-copy.js n=6000000 partial='false' bytes=32768          *      3.62 %       ±3.30% ±4.44%  ±5.89%
 buffers/buffer-copy.js n=6000000 partial='true' bytes=0             ***    566.67 %       ±3.63% ±4.87%  ±6.42%
 buffers/buffer-copy.js n=6000000 partial='true' bytes=8             ***     24.66 %       ±1.17% ±1.57%  ±2.05%
 buffers/buffer-copy.js n=6000000 partial='true' bytes=128           ***     19.53 %       ±0.61% ±0.81%  ±1.06%
 buffers/buffer-copy.js n=6000000 partial='true' bytes=32768                 -0.52 %       ±0.98% ±1.31%  ±1.70%
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@mscdex mscdex added buffer Issues and PRs related to the buffer subsystem. performance Issues and PRs related to the performance of Node.js. labels Aug 9, 2019
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@YurySolovyov

Copy link
Copy Markdown

any results for >32k?

@mscdex

mscdex commented Aug 11, 2019

Copy link
Copy Markdown
Contributor Author

@YurySolovyov No, is there a particular value you have in mind that you would like to see?

@YurySolovyov

Copy link
Copy Markdown

I just wonder if it actually degrades for larger inputs

@mscdex

mscdex commented Aug 11, 2019

Copy link
Copy Markdown
Contributor Author

FWIW I just tried with 1MB and it seems only then is there a slight regression (~1%) when doing a partial copy. The funny thing is that even deferring to C++ with no parameter/value validation (basically just a memset()) in that particular case, it slows things down significantly more than the original regression.

My guess is that there are missing optimizations in V8 for some larger values?

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@Trott

Trott commented Aug 12, 2019

Copy link
Copy Markdown
Member

@nodejs/buffer

@Trott

Trott commented Aug 14, 2019

Copy link
Copy Markdown
Member

Landed in 6d351d4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

buffer Issues and PRs related to the buffer subsystem. performance Issues and PRs related to the performance of Node.js.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants