Skip to content

[ty] Skip decorator inference for undecorated functions#24839

Merged
charliermarsh merged 1 commit intomainfrom
charlie/decorator-inference
Apr 25, 2026
Merged

[ty] Skip decorator inference for undecorated functions#24839
charliermarsh merged 1 commit intomainfrom
charlie/decorator-inference

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

@charliermarsh charliermarsh commented Apr 25, 2026

Summary

If a function has no decorators, we can skip the inference step, which leads to a nice memory saving.

@astral-sh-bot astral-sh-bot Bot added the ty Multi-file analysis & type inference label Apr 25, 2026
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 25, 2026

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 87.94%. The percentage of expected errors that received a diagnostic held steady at 83.36%. The number of fully passing files held steady at 79/133.

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 25, 2026

Memory usage report

Summary

Project Old New Diff Outcome
flake8 47.91MB 47.77MB -0.30% (146.45kB) ⬇️
trio 116.97MB 116.38MB -0.50% (602.80kB) ⬇️
sphinx 260.05MB 258.64MB -0.54% (1.41MB) ⬇️
prefect 710.16MB 706.22MB -0.56% (3.94MB) ⬇️

Significant changes

Click to expand detailed breakdown

flake8

Name Old New Diff Outcome
function_known_decorators 317.94kB 179.68kB -43.49% (138.26kB) ⬇️
infer_definition_types 1.86MB 1.85MB -0.43% (8.19kB) ⬇️

trio

Name Old New Diff Outcome
function_known_decorators 920.45kB 351.68kB -61.79% (568.77kB) ⬇️
infer_definition_types 7.57MB 7.54MB -0.44% (34.03kB) ⬇️

sphinx

Name Old New Diff Outcome
function_known_decorators 2.45MB 1.12MB -54.25% (1.33MB) ⬇️
infer_definition_types 23.65MB 23.57MB -0.33% (80.34kB) ⬇️

prefect

Name Old New Diff Outcome
function_known_decorators 8.27MB 4.55MB -45.02% (3.72MB) ⬇️
infer_definition_types 91.23MB 91.01MB -0.24% (225.80kB) ⬇️

@charliermarsh charliermarsh added internal An internal refactor or improvement performance Potential performance improvement labels Apr 25, 2026
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 25, 2026

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@charliermarsh charliermarsh marked this pull request as ready for review April 25, 2026 22:00
@charliermarsh charliermarsh merged commit a241b1f into main Apr 25, 2026
56 checks passed
@charliermarsh charliermarsh deleted the charlie/decorator-inference branch April 25, 2026 22:02
carljm added a commit to tamird/ruff that referenced this pull request Apr 27, 2026
* main: (248 commits)
  [ty] bump conformance suite commit (astral-sh#24848)
  [ty] Pass unmapped type variables to `SpecializationBuilder::build_with` (astral-sh#24809)
  [ty] Avoid bookkeeping for unannotated functions (astral-sh#24842)
  [ty] Optimize signature checking based on number of arguments (astral-sh#24674)
  [ty] Avoid eagerly inferring legacy generic context (astral-sh#24841)
  [ty] Skip decorator inference for undecorated functions (astral-sh#24839)
  [ty] solve unions against generic protocols (astral-sh#24837)
  [ty] Lazily allocate parameter type builders (astral-sh#24838)
  [ty] Lazily compute call argument fallbacks (astral-sh#24836)
  [ty] Avoid collecting type context callables (astral-sh#24835)
  Bump ecosystem-analyzer to e7576e6 (astral-sh#24834)
  [ty] Support basic narrowing with aliased conditional expressions (astral-sh#24302)
  [ty] Fix project and workspace selection (astral-sh#24824)
  [ty] Fix missing memory usage attributes (astral-sh#24823)
  Fix setting selection for multi folder workspace (astral-sh#24819)
  Improve diagnostics for implicit calls to a possibly unbound unary operator. (astral-sh#24816)
  [ty] Update review pool (astral-sh#24818)
  Bump 0.15.12 (astral-sh#24815)
  [ty] Complete support for more detailed diagnostics on possibly unbound errors from implicit dunder calls against unions. (astral-sh#24676)
  Implement `#ruff:file-ignore` file-level suppressions (astral-sh#23599)
  ...
carljm added a commit that referenced this pull request Apr 27, 2026
* main: (44 commits)
  Update cargo-bins/cargo-binstall action to v1.18.1 (#24855)
  Update dependency ruff to v0.15.12 (#24857)
  Update taiki-e/install-action action to v2.75.18 (#24864)
  [ty] Model bool-op branch snapshots (#24458)
  [ty] Support `Unpack[TypedDict]` in `**kwargs` signatures (#24653)
  Update prek dependencies (#24858)
  Update Rust crate bitflags to v2.11.1 (#24859)
  Update Rust crate clap to v4.6.1 (#24860)
  Update Rust crate mimalloc to v0.1.49 (#24862)
  Update Rust crate uuid to v1.23.1 (#24863)
  Update Rust crate rayon to v1.12.0 (#24866)
  Update Rust crate libc to v0.2.185 (#24861)
  [ty] Reserve union element storage (#24849)
  [ty] bump conformance suite commit (#24848)
  [ty] Pass unmapped type variables to `SpecializationBuilder::build_with` (#24809)
  [ty] Avoid bookkeeping for unannotated functions (#24842)
  [ty] Optimize signature checking based on number of arguments (#24674)
  [ty] Avoid eagerly inferring legacy generic context (#24841)
  [ty] Skip decorator inference for undecorated functions (#24839)
  [ty] solve unions against generic protocols (#24837)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement performance Potential performance improvement ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants