Skip to content

Performance regression in 0.0.1a4 #431

@danielhollas

Description

@danielhollas

Summary

I noticed a big performance regression in the latest release. Ultimately (and to my surprise) I was able to produce the following very simple reproducer:

from pathlib import Path

def func(p: Path) -> None:
     p.read_bytes()
/tmp via C v13.3.1-gcc via 🐍 v3.12.7 time uvx ty@0.0.1a4 check test.py 
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
All checks passed!

real	0m0.891s
user	0m0.723s
sys	0m0.165s
/tmp via C v13.3.1-gcc via 🐍 v3.12.7 time uvx ty@0.0.1a3 check test.py 
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
All checks passed!

real	0m0.070s
user	0m0.025s
sys	0m0.033s

I am honestly still thinking that I clearly must be doing something wrong... 😰

I have bisected the issue to this PR: astral-sh/ruff#18010
(this is my first time bisecting a rust program so I might have messed up somewhere).

Running with debug output reveales that the execution "freezes" always at this output:

  2025-05-16T21:50:37.723099Z  INFO ty_project: Indexed 1 file(s)
    at crates/ty_project/src/lib.rs:421 on ThreadId(2)
    in ty_project::Project::index_files with project=tmp
    in ty_project::Project::check

Checking ------------------------------------------------------------ 0/1 files                                                             2025-05-16T21:50:37.723229Z DEBUG ty_python_semantic::types: Checking file '/tmp/test.py'
    at crates/ty_python_semantic/src/types.rs:88 on ThreadId(2)
    in ty_project::check_file with file=file(Id(800))
    in ty_project::Project::check

But the only thing after that is

All checks passed!
  2025-05-16T21:50:38.568862Z DEBUG ty: Exiting main loop
    at crates/ty/src/lib.rs:227 on ThreadId(1)

Version

0.0.1a4

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePotential performance improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions