-
Notifications
You must be signed in to change notification settings - Fork 176
Rework promise rejection tracker #1058
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
Conversation
Sorry for the back and forth here, I got blinsided. |
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.
rejected_promise_list
is scanned in linear fashion. How big is it expected to grow under normal operations?
I understand in-flight promises are added and removed continuously so I suppose it can grow pretty big in a promise-heavy script?
@@ -51060,7 +51016,8 @@ static __exception int perform_promise_then(JSContext *ctx, | |||
if (s->promise_state == JS_PROMISE_REJECTED && !s->is_handled) { | |||
JSRuntime *rt = ctx->rt; | |||
if (rt->host_promise_rejection_tracker) | |||
JS_EnqueueJob(ctx, promise_rejection_tracker_job, 1, &promise); | |||
rt->host_promise_rejection_tracker(ctx, promise, s->promise_result, | |||
true, rt->host_promise_rejection_tracker_opaque); |
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.
Why is is_handled==true? I would've expected false.
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.
Because here we are attaching a catch AFAIK.
Not sure, I guess I can measure? Any specific test you'd like to run?
Maybe? Any particular worries? |
This reverts a75498b and a4a5a17 (except the tests) and adapts bellard/quickjs@3c39307 which also passes the tests and feels like a better solution overall. Ref: #1038
fb80890
to
6fddfe8
Compare
I don't think we have tests or benchmarks (neither does web-tooling-benchmark) that really stress-tests promises. I'm thinking of a modern node.js server app, they commonly have 100s or 1,000s of promises in-flight at any given moment. |
Right. Note that we only really keep track of rejected ones so the rest of the lookups should be fast? Unless you have a ton of rejected ones... Are you ok landing as is and looking into perf improvements if / when necessary? |
Yeah, that's fine. Just something to be mindful of. |
This reverts a75498b and a4a5a17 (except the tests) and adapts bellard/quickjs@3c39307 which also passes the tests and feels like a better solution overall.
Ref: #1038