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

Node.js 18.8.0 supported Performance interface #25007

Merged
merged 7 commits into from
Dec 16, 2024

Conversation

skyclouds2001
Copy link
Contributor

@skyclouds2001 skyclouds2001 commented Nov 8, 2024

Summary

the exact version of when the Performance class is exposed to global is not mentioned (only mentioned the performance global property)

in node v19.0.0, while other performance related features has been exposed via nodejs/node#44483, the Performance interface has been exposed yet;
in node v16.0.0, only performance global proeprty is exposed to global via nodejs/node#37970;
in node v18.8.0, here the Performance interface is exposed to global via nodejs/node#44220, before this version, it is only available as an internal instance.

Test results and supporting details

https://nodejs.org/docs/latest/api/globals.html#performance
https://nodejs.org/docs/latest/api/perf_hooks.html#perf_hooksperformance

Related issues

@github-actions github-actions bot added the data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label Nov 8, 2024
@skyclouds2001 skyclouds2001 marked this pull request as ready for review November 8, 2024 18:06
api/Performance.json Outdated Show resolved Hide resolved
},
{
"version_added": "8.5.0",
"partial_implementation": true,
"notes": "Exported from the <code>perf_hooks</code> module"
"notes": "Only available as an internal instance."
Copy link
Contributor

Choose a reason for hiding this comment

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

How could users interact with this interface, if it wasn't exported prior to 18.8.0?

Copy link
Contributor Author

@skyclouds2001 skyclouds2001 Nov 13, 2024

Choose a reason for hiding this comment

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

though the interface can't be accessed directly, but it can be accessed via performance property: require('perf_hooks').performance.__proto__.constructor

performance.__proto__.constructor === Performance will report true in latest node

and another reason is that there is a rule which force parent feature' version must not be greater or equal than child feature's version

see also #25001 (comment) and #24998 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

it can be accessed via performance property: require('perf_hooks').performance.__proto__.constructor

Should we mention this explicitly? I feel like the previous note was somewhat more informative.

Suggested change
"notes": "Only available as an internal instance."
"notes": "Only available as an internal instance (`require('perf_hooks').performance.__proto__.constructor`)."

Copy link
Contributor

Choose a reason for hiding this comment

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

@skyclouds2001 What do you think about this suggestion? 👆

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the info of how to access the interface is not required, as in most case user will not access this interface directly but use its properites and methods; and since the info is only for old node.js version, very fewer user will use it.

@caugner caugner added the nodejs Data about Node.js label Nov 12, 2024
@github-actions github-actions bot added the merge conflicts 🚧 This PR needs to merge latest "main" branch to resolve a merge conflict or other issue. label Nov 18, 2024
Copy link

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions github-actions bot removed the merge conflicts 🚧 This PR needs to merge latest "main" branch to resolve a merge conflict or other issue. label Nov 18, 2024
@github-actions github-actions bot added the size:xs [PR only] 0-6 LoC changed label Nov 21, 2024
Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@caugner caugner changed the title Fix & update nodejs data for Performance interface Node.js 18.8.0 supported Performance interface Dec 16, 2024
@caugner caugner merged commit 207f893 into mdn:main Dec 16, 2024
9 checks passed
@skyclouds2001 skyclouds2001 deleted the node-performance branch December 16, 2024 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API nodejs Data about Node.js size:xs [PR only] 0-6 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants