-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
lib: refactor project to use Promise.withResolvers
#54836
Conversation
Review requested:
|
bc7bdeb
to
3e6cec1
Compare
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.
After all these years - this is still a bad API but we might as well use the official one :D
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.
@anonrig could this have any impact on pref?
Should any benchmarks be run?
I think it will improve performance but I'm not sure. Once the tests pass, let's have a benchmark ci just to be sure. |
|
It seems like it can be removed by a v8 flag: https://github.com/v8/v8/blob/3b12a031d2293acf01872e213473c8657671c8db/src/init/bootstrapper.cc#L5585 |
We should probably wait for 20.x to be in maintenance so it does not create conflicts when backporting other PRs (we could also wait for V8 to drop the flag, but we don't officially support running Node.js with undocumented flags, so that's not a blocker) |
@anonrig ... I see you marked this |
Alternatively, if we choose to backport this, we could also choose to polyfill |
We've decided that any change to globally available APIs would be semver-major in #54330 (I mean it hasn't landed yet, but it already has your approval 😅), so backporting to v20.x is a no-go. |
0c08b61
to
c69b907
Compare
If it’s a correct polyfill, why does it matter which it is? |
@aduh95 We already have polyfills in primordials
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #54836 +/- ##
==========================================
- Coverage 88.40% 88.39% -0.02%
==========================================
Files 653 653
Lines 187600 187585 -15
Branches 36117 36120 +3
==========================================
- Hits 165854 165821 -33
- Misses 14974 14981 +7
- Partials 6772 6783 +11
|
And we shouldn't – especially the |
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 (but I agree with the moving of the polyfill)
Blocked on #55115 |
This needs a rebase. |
# Conflicts: # lib/internal/blob.js # lib/internal/test_runner/harness.js # lib/internal/test_runner/runner.js # test/parallel/test-runner-run-watch.mjs # test/parallel/test-runner-watch-mode-complex.mjs # test/parallel/test-runner-watch-mode.mjs
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
4adca35
to
df1b7e5
Compare
Landed in bb8cc65 |
PR-URL: #54836 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
PR-URL: nodejs#54836 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Node.js v22+ supports
Promise.withResolvers()
. Let's use them!