Skip to content

[runtime-async] Optimize synchronous Task-returning wrappers used in async context #115771

Open
@jakobbotsch

Description

@jakobbotsch

Developers frequently create synchronous Task-returning methods wrapping an async one to avoid additional state machines. For example, it is being done right now in #115688.

With runtime async this is a significant deoptimization. We should figure out how to optimize this pattern. One possible way would be to boost inlining for synchronous Task-returning methods calls by runtime async methods, and then adding an additional IR-based optimization of AsyncHelpers.Await(M()) later in the JIT (the current optimization is based on IL pattern recognition that will not kick in after inlining).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIruntime-asynctenet-performancePerformance related issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions