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

perf_hooks: make nodeTiming a first-class object #35977

Closed
wants to merge 5 commits into from

Conversation

mmomtchev
Copy link
Contributor

Render all properties of nodeTiming enumerable
so JSON.stringify and Object.keys can access them

Fixes: #35936

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Render all properties of nodeTiming enumerable
so JSON.stringify and Object.keys can access them

Fixes: nodejs#35936
@nodejs-github-bot nodejs-github-bot added the perf_hooks Issues and PRs related to the implementation of the Performance Timing API. label Nov 5, 2020
@Trott Trott added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 5, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 5, 2020
@nodejs-github-bot
Copy link
Collaborator

Improve readability as per @aduh95 suggestion

Refs: nodejs#35977
Transform the static values to plain properties
(@addaleax review)

Refs: nodejs#35977
@addaleax
Copy link
Member

addaleax commented Nov 6, 2020

Actually, I’d make all of these configurable … it can be nice to be able to override them for testing purposes if that’s ever necessary

Render all properties configurable
(@addaleax review)

nodejs#35977

idleTime: {
...PerformanceNodeTimingProps,
Copy link
Member

Choose a reason for hiding this comment

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

Non-blocking: I would just include the properties directly here (rather than use the repeated `...PerformanceNodeTimingProps) even if they're going to be duplicated just to save an unnecessary performance cost.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, do you think V8 keeps a reference to the initializing object when using the spread operator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this is ECMA specified in fact

Render all properties of nodeTiming enumerable
so JSON.stringify and Object.keys can access them

Refs: nodejs#35977
@Trott Trott added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 7, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 7, 2020
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Nov 11, 2020
@aduh95
Copy link
Contributor

aduh95 commented Nov 14, 2020

Landed in feff385

@aduh95 aduh95 closed this Nov 14, 2020
aduh95 pushed a commit that referenced this pull request Nov 14, 2020
Render all properties of nodeTiming enumerable
so JSON.stringify and Object.keys can access them

Fixes: #35936

PR-URL: #35977
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@spazmodius
Copy link

spazmodius commented Nov 15, 2020

@mmomtchev
Copy link
Contributor Author

Does this obviate the need for [util.inspect.custom]()?
See https://github.com/mmomtchev/node/blob/778f60b7626f0a715ae4071cdb944165251028e9/lib/perf_hooks.js#L257

No, you still need it to get a pretty console output, you see [Getter] instead of the actual value without it

codebytere pushed a commit that referenced this pull request Nov 22, 2020
Render all properties of nodeTiming enumerable
so JSON.stringify and Object.keys can access them

Fixes: #35936

PR-URL: #35977
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@codebytere codebytere mentioned this pull request Nov 22, 2020
targos pushed a commit that referenced this pull request May 1, 2021
Render all properties of nodeTiming enumerable
so JSON.stringify and Object.keys can access them

Fixes: #35936

PR-URL: #35977
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@danielleadams danielleadams mentioned this pull request May 3, 2021
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. perf_hooks Issues and PRs related to the implementation of the Performance Timing API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PerformanceEntry toJSON()
7 participants