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: make general improvements to Buffer docs #7784

Merged
merged 7 commits into from
Jul 22, 2016

Conversation

mscdex
Copy link
Contributor

@mscdex mscdex commented Jul 18, 2016

Checklist
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
  • doc
Description of change
  • Fix existing metadata and add new metadata
  • Reorganize and add more link references
  • Better consistency in wording, code examples, and coding style
  • Make default function parameter values more easily visible
  • Fill in more function parameter and return value descriptions

@mscdex mscdex added buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. labels Jul 18, 2016
@mscdex
Copy link
Contributor Author

mscdex commented Jul 18, 2016

/cc @nodejs/documentation

@silverwind
Copy link
Contributor

1,150 additions, 770 deletions not shown because the diff is too large.

Darn you, GitHub. @mscdex would you mind splitting up in two or more logical commits so we can do inline review?

@mscdex
Copy link
Contributor Author

mscdex commented Jul 19, 2016

@silverwind Done.

@mscdex
Copy link
Contributor Author

mscdex commented Jul 20, 2016

/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
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@trevnorris
Copy link
Contributor

Made it about half way through tonight. Awesome work.

@jasnell
Copy link
Member

jasnell commented Jul 20, 2016

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).
Copy link
Member

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?

@trevnorris
Copy link
Contributor

Thanks for the changes. LGTM

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]>
@mscdex mscdex merged commit b3127df into nodejs:master Jul 22, 2016
@mscdex mscdex deleted the doc-improve-buffer branch July 22, 2016 21:45
@cjihrig cjihrig mentioned this pull request Aug 8, 2016
cjihrig pushed a commit that referenced this pull request Aug 10, 2016
PR-URL: #7784
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trevor Norris <[email protected]>
cjihrig pushed a commit that referenced this pull request Aug 10, 2016
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]>
cjihrig pushed a commit that referenced this pull request Aug 10, 2016
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]>
cjihrig pushed a commit that referenced this pull request Aug 10, 2016
PR-URL: #7784
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trevor Norris <[email protected]>
cjihrig pushed a commit that referenced this pull request Aug 10, 2016
PR-URL: #7784
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trevor Norris <[email protected]>
cjihrig pushed a commit that referenced this pull request Aug 10, 2016
PR-URL: #7784
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trevor Norris <[email protected]>
cjihrig pushed a commit that referenced this pull request Aug 10, 2016
PR-URL: #7784
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trevor Norris <[email protected]>
@cjihrig cjihrig mentioned this pull request Aug 11, 2016
@MylesBorins
Copy link
Contributor

@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

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. doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants