-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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: expose performance
global
#28635
Comments
I'm quite confused, it would be something like |
I think the suggestion is that |
In that case won't be difference between using require like: |
console.log(require('timers').setTimeout === global.setTimeout); // true |
can I work on this? |
@jasnell any objections here? |
Can I? |
Yes. Not that you need my permission or authority or anything, but if it makes you feel OK about forging ahead: Go for it. No guarantees that it will be accepted or that someone else isn't already working on it (although they probably aren't), but if this is something you'd like to see in Node.js core, you should totally put together a pull request for it. |
Done at #29432 using |
Yikes, I just spotted this. There's a reason we don't expose it as a global... Specifically, doing so is semver-major and the current implementation is not fully compatible with the browser version. |
IIRC, the convention is exposing a Web API to global when it is no longer experimental. I think at least we should take a look into the criteria for moving performance out of experimental status first. |
Is there a tracking list of what should have been done to move |
I think it's time that we could. The module has been stable for a while now. There's really no checklist necessary in this case. It has tests, it's being used, so I think we could just open a PR making it stable. I still do not believe we should make the |
fwiw, here is one or more criteria that can be reasonably checked against, for experimental exit:
|
I think it would be good to at least import https://github.com/web-platform-tests/wpt/tree/master/performance-timeline and figure out the difference between the Web before moving this to global, considering people could very well use the same code as how they would use it on the Web and run into differences (which could either be bugs or just wontfix). It would also be good to figure out the subset of performance timeline we want to implement and what we explicitly won't. |
- Add clarifications for Node.js-only extensions - Explain the Web Performance APIs implemented in Node.js and clarify that perf_hooks also include other non-Web APIs. - Prefix exposed interfaces with `perf_hooks.` to distinguish them from internal classes. PR-URL: #33199 Refs: #28635 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
- Add clarifications for Node.js-only extensions - Explain the Web Performance APIs implemented in Node.js and clarify that perf_hooks also include other non-Web APIs. - Prefix exposed interfaces with `perf_hooks.` to distinguish them from internal classes. PR-URL: #33199 Refs: #28635 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
- Add clarifications for Node.js-only extensions - Explain the Web Performance APIs implemented in Node.js and clarify that perf_hooks also include other non-Web APIs. - Prefix exposed interfaces with `perf_hooks.` to distinguish them from internal classes. PR-URL: #33199 Refs: #28635 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
- Add clarifications for Node.js-only extensions - Explain the Web Performance APIs implemented in Node.js and clarify that perf_hooks also include other non-Web APIs. - Prefix exposed interfaces with `perf_hooks.` to distinguish them from internal classes. PR-URL: #33199 Refs: #28635 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Fixed by #37970. |
Browsers export a
performance
global, and I think we should too if theperf_hooks
module is stable enough (and can be lifted from experimental stability) to allow easy usage in isomorphic scripts.The text was updated successfully, but these errors were encountered: