-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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: make general improvements to Buffer docs #7784
Conversation
/cc @nodejs/documentation |
Darn you, GitHub. @mscdex would you mind splitting up in two or more logical commits so we can do inline review? |
c33ab18
to
977fdef
Compare
@silverwind Done. |
/cc @nodejs/collaborators |
[`TypedArray.from()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from | ||
|
||
[`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ||
[`ArrayBuffer#slice()`]:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/slice |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: space before the link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Made it about half way through tonight. Awesome work. |
977fdef
to
5867219
Compare
Woo! LGTM |
@@ -542,14 +537,13 @@ Note that the `Buffer` module pre-allocates an internal `Buffer` instance of | |||
size [`Buffer.poolSize`] that is used as a pool for the fast allocation of new | |||
`Buffer` instances created using [`Buffer.allocUnsafe()`] (and the deprecated | |||
`new Buffer(size)` constructor) only when `size` is less than or equal to | |||
`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default | |||
value of `Buffer.poolSize` is `8192` but can be modified. | |||
`Buffer.poolSize >> 1` (floor of [`Buffer.poolSize`] divided by two). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want this "floor of ... divided by two" here? Looks like condition doesn't change if we remove it, Buffer.poolSize >> 1
is rather computation optimization than something users should be aware of.
For example, if Buffer.poolSize
would be equal to 3
, both conditions size is less than or equal to Buffer.poolSize >> 1 (floor of Buffer.poolSize divided by two)
(size <= 1
) and size is less than or equal to Buffer.poolSize divided by two
(size <= 1.5
) are equal for any integer size
.
Or do we explicitly want to specify behavior for cases when floating number is passed as a size
?
Thanks for the changes. LGTM |
5867219
to
8b6d7bd
Compare
PR-URL: nodejs#7784 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
This commit adds more links and separates internal doc links from external web links. PR-URL: nodejs#7784 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
This commit adds more links and reuses existing link references more. PR-URL: nodejs#7784 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
PR-URL: nodejs#7784 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
PR-URL: nodejs#7784 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
PR-URL: nodejs#7784 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
PR-URL: nodejs#7784 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
8b6d7bd
to
b3127df
Compare
PR-URL: #7784 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
This commit adds more links and separates internal doc links from external web links. PR-URL: #7784 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
This commit adds more links and reuses existing link references more. PR-URL: #7784 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
PR-URL: #7784 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
PR-URL: #7784 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
PR-URL: #7784 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
PR-URL: #7784 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
@mscdex I'm going to pass on landing this due to it being such a big change, and not being 100% if it aligns to the v4.x implementation of buffer. Please feel free to backport |
Checklist
Affected core subsystem(s)
Description of change