Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@bnoordhuis
Copy link
Member

Pretty-print typed arrays like regular arrays. Speeds up formatting by
almost 300% because it no longer stringifies the array indices.

Pretty-print ArrayBuffer and DataView as well by including byteLength,
byteOffset and buffer properties in the stringified representation.

Taggging this semver-major for now. Maybe overcautious?

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

@bnoordhuis bnoordhuis added util Issues and PRs related to the built-in util module. semver-major PRs that contain breaking changes and should be released in the next major version. labels Nov 12, 2015
Copy link
Contributor

Choose a reason for hiding this comment

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

Object.keys((new ArrayBuffer(5))).length === 0. Should this be placed in the shortcut path above?

Copy link
Contributor

Choose a reason for hiding this comment

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

nm. overlooked the other keys additions.

Copy link
Contributor

Choose a reason for hiding this comment

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

hah. so I wasn't loosing it:

Object.keys(new ArrayBuffer(5)).length === 0;
Object.getOwnPropertyNames(new ArrayBuffer(5)).length === 0;
Object.getOwnPropertySymbols(new ArrayBuffer(5)) === 0;

Copy link
Member Author

Choose a reason for hiding this comment

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

I put it here because it adds a key for .byteLength but I can probably move it up and call formatProperty() directly, likewise for DataView. Good idea / bad idea?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a fast path for ArrayBuffer, PTAL.

Copy link
Contributor

Choose a reason for hiding this comment

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

I like it.

@trevnorris
Copy link
Contributor

LGTM

@bnoordhuis
Copy link
Member Author

Pretty-print typed arrays like regular arrays.  Speeds up formatting by
almost 300% because it no longer stringifies the array indices.

Pretty-print ArrayBuffer and DataView as well by including byteLength,
byteOffset and buffer properties in the stringified representation.

PR-URL: nodejs#3793
Reviewed-By: Rod Vagg <rod@vagg.org>
@bnoordhuis bnoordhuis closed this Nov 14, 2015
@bnoordhuis bnoordhuis deleted the pretty-typed-arrays branch November 14, 2015 12:31
@bnoordhuis bnoordhuis merged commit 6cf2cff into nodejs:master Nov 14, 2015
bnoordhuis added a commit to bnoordhuis/io.js that referenced this pull request Nov 14, 2015
Pretty-print typed arrays like regular arrays.  Speeds up formatting by
almost 300% because it no longer stringifies the array indices.

Pretty-print ArrayBuffer and DataView as well by including byteLength,
byteOffset and buffer properties in the stringified representation.

PR-URL: nodejs#3793
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
@bnoordhuis
Copy link
Member Author

Thanks for review, landed in 34a3591. Apologies, I initially landed it with the wrong Reviewed-By tag.

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

Labels

semver-major PRs that contain breaking changes and should be released in the next major version. util Issues and PRs related to the built-in util module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.