Skip to content

Conversation

@jasnell
Copy link
Member

@jasnelljasnell commented Jun 12, 2022

The use of makeTransferable on all AbortSignal instances made creating them always slow,
causing bottlenecks in stuff like Web Streams. This refactors that so that AbortSignals
are not transferable by default, which is actually the correct standard behavior anyway.
A new transferableAbortSignal and transferableAbortController utility is provided to
enable the transferable use case.

Signed-off-by: James M Snell [email protected]
Fixes: #43160

/cc @mcollina@ronag

The use of makeTransferable on all AbortSignal instances made creating them always slow, causing bottlenecks in stuff like Web Streams. This refactors that so that AbortSignals are not transferable by default, which is actually the correct standard behavior anyway. A new transferableAbortSignal and transferableAbortController utility is provided to enable the transferable use case. Signed-off-by: James M Snell <[email protected]>
@nodejs-github-botnodejs-github-bot added needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module. worker Issues and PRs related to Worker support. labels Jun 12, 2022
@benjamingr
Copy link
Member

Note the failing tests

Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@nodejs-github-bot
Copy link
Collaborator

<!--
added: REPLACEME
-->

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
> Stability: 1 - Experimental

<!--
added: REPLACEME
-->

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
> Stability: 1 - Experimental

* }} [init]
* @returns{AbortSignal}
*/
functioncreateAbortSignal(init){
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
functioncreateAbortSignal(init){
functioncreateAbortSignal(init=kEmptyObject){

and then requiring kEmptyObject from internal/util will probably fix the test failures. You might also want to rebase to include the change from #43159 for this to work.

@jasnell
Copy link
MemberAuthor

Superseded by #44048

@jasnelljasnell closed this Jul 30, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ciPRs that need a full CI run.utilIssues and PRs related to the built-in util module.workerIssues and PRs related to Worker support.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transferrable AbortController is very slow

6 participants

@jasnell@benjamingr@nodejs-github-bot@mcollina@ronag@RaisinTen