Skip to content

Consider storing a Box<[T]> or shrink the tuple's inner Vec's before wrapping them as Type #956

@MichaReiser

Description

@MichaReiser

Both FixedLengthTupleType and VariableLengthTupleType contain Vec<T> fields that we don't shrink before constructing a TupleTypeSpec (to my knowledge). This can result in increased memory usage because of the unused elements in those vecs.

https://github.com/astral-sh/ruff/blob/41207ec901340423d988b85dc8138e306f9a39c2/crates/ty_python_semantic/src/types/tuple.rs#L323

https://github.com/astral-sh/ruff/blob/41207ec901340423d988b85dc8138e306f9a39c2/crates/ty_python_semantic/src/types/tuple.rs#L540-L544

Metadata

Metadata

Assignees

No one assigned

    Labels

    memoryrelated to memory usage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions