Skip to content

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-botnodejs-github-bot added the perf_hooks Issues and PRs related to the implementation of the Performance Timing API. label Nov 5, 2020
@TrottTrott added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 5, 2020
@github-actionsgithub-actionsbot 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

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

},

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
ContributorAuthor

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
ContributorAuthor

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
@TrottTrott added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 7, 2020
@github-actionsgithub-actionsbot 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

@aduh95aduh95 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

Landed in feff385

@aduh95aduh95 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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
@spazmodius
Copy link

spazmodius commented Nov 15, 2020

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

@mmomtchev
Copy link
ContributorAuthor

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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
@codebyterecodebytere 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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
@danielleadamsdanielleadams mentioned this pull request May 3, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.perf_hooksIssues 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

@mmomtchev@nodejs-github-bot@addaleax@aduh95@spazmodius@jasnell@Trott