Skip to content

Conversation

sharkdp
Copy link
Contributor

@sharkdp sharkdp commented Aug 28, 2025

Summary

Add regression benchmarks for the problematic cases in astral-sh/ty#758. I'd like to merge this before #20128 to measure the impact (local tests show that this will "solve" both cases).

@sharkdp sharkdp added internal An internal refactor or improvement performance Potential performance improvement ty Multi-file analysis & type inference labels Aug 28, 2025
Comment on lines -453 to -454
self.a = ""
self.b = ""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently something changed here, because previously it was able to reproduce this with the attributes at the beginning of the method. Now it only seems to reproduce if they are defined at the end, after all returns.

Comment on lines +466 to +469
if isinstance(self.b, str):
return
if isinstance(self.b, str):
return
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We reduced this so much that it wasn't actually showing a problematic runtime anymore. So I added two more clauses.

Copy link

codspeed-hq bot commented Aug 28, 2025

CodSpeed Instrumentation Performance Report

Merging #20133 will degrade performances by 34.43%

Comparing david/add-instance-attribute-benchmarks (e407e4e) with main (d9aaacd)

Summary

❌ 1 (👁 1) regressions
✅ 41 untouched benchmarks
🆕 1 new benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
👁 ty_micro[complex_constrained_attributes_2] 63.1 ms 96.3 ms -34.43%
🆕 ty_micro[complex_constrained_attributes_3] N/A 260.9 ms N/A

@sharkdp sharkdp marked this pull request as ready for review August 28, 2025 12:47
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@sharkdp sharkdp merged commit e586f6d into main Aug 28, 2025
38 checks passed
@sharkdp sharkdp deleted the david/add-instance-attribute-benchmarks branch August 28, 2025 13:25
dcreager added a commit that referenced this pull request Aug 28, 2025
* main:
  Fix mdtest ignore python code blocks (#20139)
  [ty] add support for cyclic legacy generic protocols (#20125)
  [ty] add cycle detection for find_legacy_typevars (#20124)
  Use new diff rendering format in tests (#20101)
  [ty] Fix 'too many cycle iterations' for unions of literals (#20137)
  [ty] No boundness analysis for implicit instance attributes (#20128)
  Bump 0.12.11 (#20136)
  [ty] Benchmarks for problematic implicit instance attributes cases (#20133)
  [`pyflakes`] Fix `allowed-unused-imports` matching for top-level modules (`F401`) (#20115)
  Move GitLab output rendering to `ruff_db` (#20117)
  [ty] Evaluate reachability of non-definitely-bound to Ambiguous (#19579)
  [ty] Introduce a representation for the top/bottom materialization of an invariant generic (#20076)
  [`flake8-async`] Implement `blocking-http-call-httpx` (`ASYNC212`) (#20091)
  [ty] print diagnostics with fully qualified name to disambiguate some cases (#19850)
  [`ruff`] Preserve relative whitespace in multi-line expressions (`RUF033`) (#19647)
second-ed pushed a commit to second-ed/ruff that referenced this pull request Sep 9, 2025
…stral-sh#20133)

## Summary

Add regression benchmarks for the problematic cases in
astral-sh/ty#758. I'd like to merge this
before astral-sh#20128 to measure the
impact (local tests show that this will "solve" both cases).
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