Skip to content

Sync* methods are too slow. #32102

@lrhn

Description

@lrhn

I've been recommended not using a sync* function to generate an iterable in platform code because it is too slow.
We should not have a language feature that is so slow that you are better off not using it. Then we are better off not having it.
We should try to make sync* functions as efficient as a hand-coded iterator, or close to it.
(The VM might be able to run them on a separate stack, and avoid desugaring completely, which will make it as efficient as possible. Desugaring to a state-machine should be an optimizing compiler, not a simple translation.)

(I assume async* functions are slow too).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-metaCross-cutting, high-level issues (for tracking many other implementation issues, ...).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions