mirror of
https://github.com/astral-sh/ruff.git
synced 2026-11-22 09:50:54 +08:00
## Summary When ty checks the call to `super().__init__` in Bokeh’s `HatchPatternType`, it solves constraints on the type variables in the overloads of `Either.__init__`. At each node of the constraint diagram, the solver builds a cache key from the assignments that could affect its solutions. It can scan the path several times to find those assignments even when every type variable is already relevant. [Bokeh call site](https://github.com/bokeh/bokeh/blob/378373772846cdfedc1c641ce9219dcbc34b6b9c/src/bokeh/core/property/visual.py#L137-L147) · [Reproducer](https://github.com/astral-sh/ty/issues/5063#bokeh-receiver-specialization) We now stop expanding the set of relevant variables when it contains every type variable in the constraint storage. Each constraint has a subject variable, so every positive and negative assignment on that path belongs in the key. We reserve space for the assignments up front and sort them by local constraint ID, which gives each set a canonical order within the walk. Cold checks of Bokeh’s `src` and `tools/release` (492 files) used 3.35–3.38% fewer instructions in opposite orders, with a 0.018% same-binary control spread. Both builds produced the same 686 diagnostics. On `src/bokeh/core/property/visual.py` alone, the reduction was 13.97–13.98%. Applying this patch on top of the early exit in #30653 reduced the remaining instruction count on `visual.py` by 33.95–34.13%. | Project | [Base instructions](https://github.com/astral-sh/ruff/commit/a866aff503fd777156c1ae4eae318a3795fa09ec) | [PR instructions](https://github.com/astral-sh/ruff/commit/478a66e6de8adf9fa740cd8af0d380e0c2e4db6a) | Change | Paired range | | --- | ---: | ---: | ---: | ---: | | [Black](https://github.com/psf/black/tree/55996d1fb8342725c8a19b6023cd9439c3c1d6f7) (inconclusive) | 3,174,108,256.5 | 3,173,516,722 | -0.02% | -0.03% to 0.00% | | [discord.py](https://github.com/Rapptz/discord.py/tree/65232c38702be5844cf2ce865a4777eb1928b5d0) | 8,235,225,120 | 8,242,644,305.5 | +0.09% | +0.05% to +0.13% | | [Home Assistant](https://github.com/home-assistant/core/tree/c19ae285ede74cd64c3045a3a4aa43290c224f1b) | 159,254,140,465 | 159,217,941,862.5 | -0.02% | -0.04% to -0.01% | | [isort](https://github.com/pycqa/isort/tree/a514c71ed86c2216d0040c7d60e302ed76a4f7ab) (inconclusive) | 1,861,761,369.5 | 1,862,681,165 | +0.05% | +0.03% to +0.07% | | [Jinja](https://github.com/pallets/jinja/tree/5ef70112a1ff19c05324ff889dd30405b1002044) (inconclusive) | 1,946,829,713 | 1,943,623,224 | -0.16% | -0.22% to -0.11% | | [pandas](https://github.com/pandas-dev/pandas/tree/a0225b65720018f4654390bb16d254daa6ee5e54) | 28,855,744,409 | 28,817,081,431 | -0.13% | -0.14% to -0.13% | | [pandas-stubs](https://github.com/pandas-dev/pandas-stubs/tree/8dd6d91b1c05b26e30f7ddbe3dc3d4042a92bdd6) (inconclusive) | 2,975,665,415.5 | 2,977,886,827.5 | +0.07% | -0.08% to +0.23% | | [Prefect](https://github.com/PrefectHQ/prefect/tree/a9452ac21852755311913cb27887b083b5007c03) (inconclusive) | 4,959,292,278 | 4,957,042,736 | -0.05% | -0.10% to +0.01% | | [PyTorch](https://github.com/pytorch/pytorch/tree/ab92945cea42e47ae398aead69af0872d340ea0f) (inconclusive) | 96,677,077,177.5 | 96,597,935,276 | -0.08% | -0.15% to -0.01% | | [HTTPX](https://github.com/encode/httpx/tree/b5addb64f0161ff6bfe94c124ef76f6a1fba5254) (inconclusive) | 1,684,159,398.5 | 1,682,827,570.5 | -0.08% | -0.21% to +0.05% | | [NumPy](https://github.com/numpy/numpy/tree/f9f1772ce010001208475f751d19253469788410) (inconclusive) | 8,498,640,458 | 8,484,590,326 | -0.17% | -0.34% to +0.01% | | [FastAPI](https://github.com/fastapi/fastapi/tree/7a0a3f0b286c6c865cf4398ea0e957a87b8bffa4) (inconclusive) | 3,008,414,987 | 3,008,383,732 | 0.00% | -0.01% to +0.01% | | [SQLAlchemy](https://github.com/sqlalchemy/sqlalchemy/tree/10f4d1e2d706a7722ca78e79ce05b00333a7aa5b) | 21,538,629,407 | 21,493,439,331 | -0.21% | -0.23% to -0.19% | | [Rich](https://github.com/Textualize/rich/tree/9d8f9a372cc5916fd4781fec207ced7ddac2f08f) (inconclusive) | 2,721,291,053.5 | 2,722,920,861 | +0.06% | -0.06% to +0.18% | | [Django](https://github.com/django/django/tree/b501b8493f31cf8cba31211d59b3b78642b8cb02) (inconclusive) | 13,909,811,424 | 13,898,353,119.5 | -0.08% | -0.18% to +0.02% | | [SymPy](https://github.com/sympy/sympy/tree/85d3998a4517ffbc8a9709b8efa769bb417c174a) | 46,205,015,573 | 46,157,556,697.5 | -0.10% | -0.14% to -0.06% | | [OpenAI Python SDK](https://github.com/openai/openai-python/tree/f6e8480f9a5b2a4d02b17a1da54a1e57964bc312) (inconclusive) | 16,017,127,816.5 | 16,015,781,142 | -0.01% | -0.02% to 0.00% | | [pytest](https://github.com/pytest-dev/pytest/tree/8b005ed7f972987033ec34dc1e68b0635fb8142b) (inconclusive) | 8,821,640,105.5 | 8,817,780,883.5 | -0.04% | -0.16% to +0.07% | | [aiohttp](https://github.com/aio-libs/aiohttp/tree/fe099491d275ef2c21bf683e024e34d51ac05d43) (inconclusive) | 4,175,140,184.5 | 4,176,532,153 | +0.03% | -0.04% to +0.10% | | [Ansible](https://github.com/ansible/ansible/tree/b4b2b1e82a535d27f902a71fc8396c3af138fca2) (inconclusive) | 14,440,574,326 | 14,448,686,368.5 | +0.06% | 0.00% to +0.11% | | [botocore](https://github.com/boto/botocore/tree/e250abbe956da791c16086575e6ddb1f2da81a78) (inconclusive) | 3,024,346,791.5 | 3,026,562,737.5 | +0.07% | -0.01% to +0.16% | | [Celery](https://github.com/celery/celery/tree/9c2f238334331db43f15956f131235fd3bb70fd1) | 4,823,926,685.5 | 4,819,110,155.5 | -0.10% | -0.12% to -0.08% | | [Dask](https://github.com/dask/dask/tree/249a51a1db4261791b93b4ce04e67341729939c3) | 34,971,843,985.5 | 34,929,440,768 | -0.12% | -0.15% to -0.10% | | [NetworkX](https://github.com/networkx/networkx/tree/6855cd586982cc2e4710b8eb87251ccf56674bf1) (inconclusive) | 15,750,955,779.5 | 15,754,926,138.5 | +0.03% | -0.01% to +0.06% | | [Pydantic](https://github.com/pydantic/pydantic/tree/560f0f96a37d6913afdfddb2de22030ef08e68c3) (inconclusive) | 13,073,082,917 | 13,064,695,805.5 | -0.06% | -0.13% to 0.00% | | [scikit-learn](https://github.com/scikit-learn/scikit-learn/tree/ee56c8b5d809dc7b970a140ed501269b63c69cf8) (inconclusive) | 66,899,541,927.5 | 66,888,821,170 | -0.02% | -0.02% to -0.01% | | [Scrapy](https://github.com/scrapy/scrapy/tree/e63a574c767d7a9438c21db158f605f1c44c6e6a) (inconclusive) | 8,979,728,756 | 8,980,454,138.5 | +0.01% | -0.14% to +0.16% | | [Transformers](https://github.com/huggingface/transformers/tree/3a134bc37f7c22c801b618e289b0255425f22647) (inconclusive) | 102,028,019,170 | 102,068,912,921 | +0.04% | -0.07% to +0.15% |
ty_python_semantic
This crate is an internal component of Ruff. The Rust API exposed here is unstable and will have frequent breaking changes.
This version (0.0.23) is a component of Ruff 0.17.6. The source can be found here.
See Ruff's crate versioning policy for details on versioning.