-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
timers: use V8 fast API calls #46579
Conversation
Review requested:
|
a97da50
to
03ec71e
Compare
static void SetupTimers(const v8::FunctionCallbackInfo<v8::Value>& args); | ||
|
||
static void SlowGetLibuvNow(const v8::FunctionCallbackInfo<v8::Value>& args); | ||
static double FastGetLibuvNow(v8::Local<v8::Object> receiver); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noting: this pattern could likely use some documentation around it as we use it more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I thought about it and then I see that other fast API calls are doing things...slightly differently. So we probably should unify them first, or find a best pattern first? (I am not even sure this is the best pattern but for the purpose of this binding this looks the most sensible to me).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can add this as an example to https://github.com/nodejs/node/blob/main/doc/contributing/adding-v8-fast-api.md?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You beat me to it! Perfect! I added the reference of the performance issue to the description.
cc @nodejs/performance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@joyeecheung not for this PR but if you're up for a challenge: on linux you could read the timestamp directly from the vDSO through a typed array that points to it. That should be many times faster still than V8's fast API. (It's something I've been meaning to do for ages but never got around to.) @billywhizz maybe an interesting technique for just-js? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing how easy it is to get consensus when we talk about this sort of thing for so long ahead of time :)
As usual great work Joyee
Failed to start CI- Validating Jenkins credentials ✖ Jenkins credentials invalidhttps://github.com/nodejs/node/actions/runs/4145265543 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Just realized that SetFastMethod() sets no side effect by default, so this needs to land on top of #46619 |
6621a78
to
9567958
Compare
9567958
to
f1c67f6
Compare
f1c67f6
to
1c1339a
Compare
Rebased after #46556 |
1c1339a
to
ca852e3
Compare
Rebased again to fix merge conflict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Landed in 1101713 |
PR-URL: #46579 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: #46579 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
@joyeecheung this broke the v18.x build when landing. Would you be able to open a backport PR for this? Thanks! |
From a local run (just the timers, the immediate ones just take too long to complete...)
Fixes nodejs/performance#49