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

[v8.x backport] util: improve inspect performance #15512

Closed
wants to merge 4 commits into from

Conversation

BridgeAR
Copy link
Member

Ref #14881

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

util

PR-URL: nodejs#14881
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
The main optimizations are
- Removed visibleKeys
- Removed proxy cache
- Removed Object.assign
- No key concatenating anymore
- No key recalculating anymore
- Improved indentation logic
- Improved string escape logic
- Added many fast paths
- Optimized code branches a lot
- Optimized (boxed) primitive handling
- Inline code if possible
- Only check extra keys if necessary
- Guard against unnecessary more expensive calls

This also fixes a bug with special array number keys as e.g. "00".

Besides that there were lots of smaller optimizations, the
code got a bit cleaned up and a few more tests got in.

PR-URL: nodejs#14881
Fixes: nodejs#15288
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
This fixes a issue brought up in nodejs#15288.

PR-URL: nodejs#14881
Refs: nodejs#15288
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Remove unnecessary code parts and outdated code

PR-URL: nodejs#14881
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
@nodejs-github-bot nodejs-github-bot added util Issues and PRs related to the built-in util module. v8.x labels Sep 20, 2017
@jasnell
Copy link
Member

jasnell commented Sep 21, 2017

LAnded thank you!

@jasnell jasnell closed this Sep 21, 2017
@BridgeAR BridgeAR deleted the backport-14881-to-v8.x branch April 1, 2019 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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