Skip to content

Consider removing infer_expression_type query #855

@MichaReiser

Description

@MichaReiser

The original motivation why we introduced the infer_expression_type was because we wanted to avoid that ty ever infers the same expression twice and that this is important for performance. astral-sh/ruff#19436 shows that this might not be the case (and it's a very naive approach at removing the query). Most benchmarks are neutral with the exception of sympy (11% regresssion).

Removing the query is motivated by the fact that the cached query results can take up up to 3GB of memory (struct fields + metadata) in large projects (~10% of overall memory usage) and this is without accounting for the Expression ingredients (another 500MB).

Metadata

Metadata

Assignees

No one assigned

    Labels

    memoryrelated to memory usageperformancePotential performance improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions