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

doc: document Buffer.concat may use internal pool #35541

Conversation

puzpuzpuz
Copy link
Member

Refs: #32703

The documentation was silent about the fact that Buffer.concat() uses Buffer.allocaUnsafe() and, thus, may return pooled buffers. This PR fixes that.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. labels Oct 7, 2020
@puzpuzpuz puzpuzpuz added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Oct 13, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 13, 2020
@nodejs-github-bot
Copy link
Collaborator

@ronag
Copy link
Member

ronag commented Oct 13, 2020

@addaleax isn't this behavior problematic for transferList? i.e. we should maybe try to only use pool if at least one of the input buffers also use the pool?

@addaleax
Copy link
Member

@ronag This should be fine after #32759, right?

@ronag
Copy link
Member

ronag commented Oct 13, 2020

@ronag This should be fine after #32759, right?

Yes and no. Should be fine in regards to the problem I was worried about. What's unfortunate is that there is no way to not use the pool when concatenating if I know that might cause problems or reduced performance (e.g. transferList). But maybe that is just a nit.

@puzpuzpuz
Copy link
Member Author

What's unfortunate is that there is no way to not use the pool when concatenating if I know that might cause problems or reduced performance (e.g. transferList). But maybe that is just a nit.

Users may decide to implement their own concat method which doesn't use the pool. Alternatively, we could introduce Buffer.concatSlow() method to make things more explicit. But that means larger API surface.

As for this very PR, it simply describes what we have now.

@ronag
Copy link
Member

ronag commented Oct 13, 2020

As for this very PR, it simply describes what we have now.

Yes, sorry for going off-topic.

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/33621/

puzpuzpuz added a commit that referenced this pull request Oct 14, 2020
PR-URL: #35541
Refs: #32703
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Harshitha K P <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
@puzpuzpuz
Copy link
Member Author

Landed in ef1645e

@puzpuzpuz puzpuzpuz closed this Oct 14, 2020
@puzpuzpuz puzpuzpuz deleted the documentation/improve-buffer-pool-doc branch October 14, 2020 17:48
MylesBorins pushed a commit that referenced this pull request Oct 14, 2020
PR-URL: #35541
Refs: #32703
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Harshitha K P <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Oct 14, 2020
MylesBorins pushed a commit that referenced this pull request Nov 3, 2020
PR-URL: #35541
Refs: #32703
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Harshitha K P <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Nov 3, 2020
MylesBorins pushed a commit that referenced this pull request Nov 16, 2020
PR-URL: #35541
Refs: #32703
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Harshitha K P <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
joesepi pushed a commit to joesepi/node that referenced this pull request Jan 8, 2021
PR-URL: nodejs#35541
Refs: nodejs#32703
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Harshitha K P <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants