Skip to content

AbortSignal pattern is slow #44

Description

@ronag

To the point that e.g. RxJS has decided not support it.

ReactiveX/rxjs#6675 (comment)

Activity

  1. anonrig commented on Feb 9, 2023

    @anonrig
    Member

    What can we do in this area? Any suggestions? @jasnell @mcollina

  2. jasnell commented on Feb 9, 2023

    @jasnell
    Member

    this was recently addressed. The change may not have been fully backported tho? Not sure.

  3. anonrig commented on Feb 9, 2023

    @anonrig
    Member

    this was recently addressed. The change may not have been fully backported tho? Not sure.

    Which particular pull request are you referring to?

  4. jasnell commented on Feb 9, 2023

    @jasnell
    Member

    #44048 looks like it was backported to 18.x in #44941 tho

  5. ronag commented on Feb 10, 2023

    @ronag
    MemberAuthor

    @jasnell do you mean the transferable fix? I think abort signals are still slow but now it's because of eventtarget.

  6. ronag commented on Feb 10, 2023

    @ronag
    MemberAuthor

    ReactiveX/rxjs#6675 (comment)

    After using AbortSignal for a large project that was dealing with high-speed emissions, the performance of AbortSignal, in particular adding and removing event listeners for abort events, was so incredibly poor that I'm unwilling to introduce any flavor of it in RxJS.

    We were waiting and waiting for this and thinking maybe we'd break ground on it in 8.x. And now I can't say that I think it's a good idea.

    Use takeUntil(fromEvent(signal, 'abort')) in the meantime.

    There has a been a lot of focus here on creating signals and events as well as emitting events but that's not actually the problem for the RxJS case...

  7. ronag commented on Feb 10, 2023

    @ronag
    MemberAuthor
  8. changed the title [-]AbortSignal is slow[/-] [+]AbortSignal pattern is slow[/+] on Feb 10, 2023
  9. jasnell commented on Feb 10, 2023

    @jasnell
    Member

    Interesting ok. Well, I guess we need to figure out how to speed up EventTarget now. That said, really none of the Web Platform standard apis were designed with performance as a high priority. We'll have to keep find ways of optimizing while still remaining compliant to the specs.

  10. santigimeno commented on Feb 10, 2023

    @santigimeno
    Member

    @jasnell any thoughts on this and specially on the Event.isTarget property? Thanks!

  11. benjamingr commented on Feb 10, 2023

    @benjamingr
    Member

    @benjamingr

    @ronag I'm reading this, I think EventTarget can be made faster (discussion in that thread + a few other ideas).

    As for RxJS's case, we can also fast-path util.aborted now that we have that. Basically when a user calls it we don't go through the addEventListener machinery and go through parallel machinery avoiding it.

  12. anonrig commented on Feb 20, 2023

    @anonrig
    Member

    Referencing: nodejs/node#46648

  13. reopened this on Feb 20, 2023
  14. reopened this on Feb 20, 2023
  15. benjamingr commented on Mar 7, 2023

    @benjamingr
    Member

    So - just to elaborate a little on RxJS's case. Us fixing EventTarget wouldn't help them at all since it would still be slow in the browser which they also support.

    Their avoidance isn't because our implementation is slow.

  16. anonrig commented on Apr 3, 2023

    @anonrig
    Member

    Closing since it's a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions