Commit Graph
22 Commits
Author SHA1 Message Date
Brent Westbrook e517fdc45f Update Rust toolchain to 1.100 and MSRV to 1.98 (#30416)
Summary
--

There were several new cargo and clippy lints here, so I tried to break
up the changes into several
commits:

- deleting some unused workspace dependencies, these looked kind of
intentional as they also had
  some shear ignores, but it seems okay to delete those too?
- allowing the [redundant_homepage] lint. We could delete a lot of
these, but the ones in the `ruff`
  and `ty` crates seem necessary for maturin, as I noted in a comment.
- fixing the [missing_lints_inheritance] lint. It seems that several of
our crates don't inherit our
workspace lints. For now I just included the `allow` for
`redundant_homepage`, but we could follow
up by inheriting the full table and fixing all the additional lints that
produces. (This commit is
  actually combined with the previous one)
- allowing cargo's new [unused_dependencies] lint, which seems redundant
with `shear` and had some
false positives on our benchmark dependencies. Codex tried to work
around this with some
`cfg`-gated imports in the benchmark crate, but ignoring this seemed
better for now, at least
  while we're still using `shear`.
- running `clippy --fix` on the remaining lint errors, with one manual
intervention where Clippy
dropped some of our `cfg` handling. These new diagnostics were mostly
around returning boolean
  expressions.
- renaming `NodeIndex::_NONE` to avoid [used_underscore_items]

There are also some new APIs in 1.98 that we can use now. I'll follow up
with those separately.

[redundant_homepage]:
https://doc.rust-lang.org/cargo/reference/lints.html#redundant_homepage
[missing_lints_inheritance]:
https://doc.rust-lang.org/cargo/reference/lints.html#missing_lints_inheritance
[used_underscore_items]:
https://clippy.rust-lang.org/master/#used_underscore_items
[unused_dependencies]:
https://doc.rust-lang.org/cargo/reference/lints.html#unused_dependencies
2026-11-16 10:04:14 -05:00
Micha Reiser c9150f0083 Add project walltime benchmarks for Ruff (#30061) 2026-11-05 15:57:31 +01:00
David Peter d4cc0a9501 [ty] Remove max_diagnostics checks for benchmarks (#28897)
## Summary

The `max_diagnostics` checks on our real-world benchmarks were
originally introduced as "stopgap" solution, a form of sanity check
([original
discussion](https://github.com/astral-sh/ruff/pull/18714#discussion_r2154190510)).
But I would argue that they are mostly a waste of developer time (they
had to be adapted ~60 times) and have never actually caught a
regression. The benchmark projects are also pinned now, so we should be
immune to external changes.

I'm proposing to remove these diagnostic limits and to add a new form of
sanity check, which looks for I/O errors or panics.
2026-09-25 16:05:48 +02:00
Charlie Marsh 50a3eae8ee Run Hawk in CI (#27372)
## Summary

We now run Hawk 0.1.13 with Rust 1.98.0 in CI, following the pattern
used by uv. The configuration preserves intentional public APIs and
generated interfaces while checking all configured production binaries
and workspace non-production targets with `-D warnings`.

The accompanying cleanup narrows internal visibility, removes unused
benchmark classification state and accessors, and records intentional
public interfaces as audited Hawk expectations. The resulting
configuration reports zero Hawk findings across the configured targets.
2026-08-26 13:51:16 -06:00
Samuel RigaudandSamuel Rigaud b1fa8c2e5b Fix typos (#26405)
Just fixed some minor typos in the project

Co-authored-by: Samuel Rigaud <rigaud@gmail.com>
2026-06-26 08:41:23 -07:00
Micha Reiser 1b0e0cf302 [ty] Update real-world benchmark pins (#26101) 2026-06-18 09:08:17 +02:00
Micha Reiser fdc07ee869 [ty] Add module resolution benchmark (#25961) 2026-06-15 13:48:48 +02:00
Charlie Marsh 2ad94df0e1 [ty] Add a SupportedPythonVersion enum (#24412)
## Summary

This unifies the validation of supported Python versions between the CLI
and TOML (e.g., `environment.python-version`) by introducing a single
enum to share across them.
2026-04-10 13:48:48 +00:00
Douglas Creager c71e169601 [ty] Implement Duboc's TDD optimization for unions of constraint sets (#23881)
For awhile we've known that our constraint sets can balloon in size when
they involve large unions, and especially intersections of large unions.
And we've had ecosystem runs (typically involving projects that depend
on numpy) that trigger this pathological behavior. #23848 is the latest
example, with a 25× performance regression for the `mesonbuild` project.

Guillaume Duboc just defended his [PhD
thesis](https://gldubc.github.io/#thesis) in January, and in §11.2, he
calls out an optimization first introduced by Frisch for handling these
kinds of unions more efficiently. The approach is also described in [a
post](https://elixir-lang.org/blog/2025/12/02/lazier-bdds-for-set-theoretic-types/)
on the Elixir blog. (Frisch and Duboc are both using these BDDs to
represent _types_, whereas we're using them to represent _constraints on
types_, but the same ideas apply.)

Frisch describes the basic idea, which is to add an "uncertain" branch
to each BDD node, turning them into ternary decision diagrams (TDDs).
Frisch also provides TDD construction rules for union (OR), intersection
(AND), and difference. Duboc takes this further and derives more
efficient rules for intersection and difference.

This PR implements TDDs and Frisch's and Duboc's construction rules.
I've confirmed that this completely eliminates the performance
regression for `mesonbuild` on #23848.

---

More details on how this works, and why we get these savings:

The key benefit is that they let us represent unions more efficiently.
As a simple example, with our quasi-reduced BDDs from before, `a ∨ b`
becomes:

```
<n1> a
┡━₁ <n2> b
│   ┡━₁ true
│   └─₀ true
└─₀ <n3> b
    ┡━₁ true
    └─₀ false
```

With TDDs, the rhs of `a ∨ b` is moved into the new "uncertain" branch:

```
<t1> a
┡━₁ true
├─? <t2> b
│   ┡━₁ true
│   ├─? false
│   └─₀ false
└─₀ false
```

We already have some savings, since the TDD representation "allows
unions to be kept lazy, postponing expansion until needed for
intersection or difference operations". We "park" the rhs as-is into the
uncertain branch, so we only need one (existing) copy of it. In the BDD
case, we had to fold the rhs into the `a = true` case, creating an
entire (modified) copy of its subgraph. That means we only need 2 nodes
for the TDD instead of 3 for the BDD. (With only two variables, this
might not seem like a lot, but we've actually gone from O(n²) nodes to
O(n).)

We get even more savings when with more complex formulas, like `(a ∨ b)
∧ (c ∨ d)`. With BDDs, we get:

```
<n1> a                      <n7> a
┡━₁ <n2> b                  ┡━₁ <n8> b
│   ┡━₁ true                │   ┡━₁ <n4> c
│   └─₀ true                │   │   ┡━₁ <n5> d
└─₀ <n3> b                  │   │   │   ┡━₁ true
    ┡━₁ true                │   │   │   └─₀ true
    └─₀ false               │   │   └─₀ <n6> d
                            │   │       ┡━₁ true
<n4> c                      │   │       └─₀ false
┡━₁ <n5> d                  │   └─₀ <n4> SHARED
│   ┡━₁ true                └─₀ <n9> b
│   └─₀ true                    ┡━₁ <n4> SHARED
└─₀ <n6> d                      └─₀ false
    ┡━₁ true
    └─₀ false
```

With TDDs, we get:

```
<t1> a                      <t5> a
┡━₁ true                    ┡━₁ <t3> c
├─? <t2> b                  │   ┡━₁ true
│   ┡━₁ true                │   ├─? <t4> d
│   ├─? false               │   │   ┡━₁ true
│   └─₀ false               │   │   ├─? false
└─₀ false                   │   │   └─₀ false
                            │   └─₀ false
<t3> c                      ├─? <t6> b
┡━₁ true                    │   ┡━₁ <t3> SHARED
├─? <t4> d                  │   ├─? false
│   ┡━₁ true                │   └─₀ false
│   ├─? false               └─₀ false
│   └─₀ false
└─₀ false
```

That's 7 nodes for the BDDs, and 4 for TDDs — still linear in the total
number of variables, even though our BDDs are only quasi-reduced. And
also note that we never had to modify the TDD that represented the rhs
of the AND (`t3 = c ∨ d`).
2026-03-16 21:58:17 -04:00
Micha Reiser ea6730f546 [ty] Speed-up instrumented benchmarks (#22133) 2025-12-22 15:06:22 +01:00
Micha Reiser 4bd454f9b5 Shard ty walltime benchmarks (#20791) 2025-10-10 07:55:50 +02:00
Micha ReiserandAlex Waygood 76387295a5 [ty] Move venv and conda env discovery to SearchPath::from_settings (#18938)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-06-26 16:39:27 +02:00
Micha Reiser 23261a38a0 [ty] Add more benchmarks (#18714) 2025-06-18 13:41:38 +02:00
Micha ReiserandAlex Waygood 770b7f3439 Vendor benchmark test files (#15878)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-02-02 18:16:07 +00:00
Micha Reiser 27c50bebec Bump MSRV to Rust 1.80 (#13826) 2024-10-20 10:55:36 +02:00
Micha Reiser ff2aa3ea00 Revert "Remove criterion/codspeed compat layer (#12524)" (#12680) 2024-08-05 07:49:04 +00:00
Carl Meyer 1c311e4fdb [red-knot] update benchmark to run on tomllib (#12635)
Changes the red-knot benchmark to run on the stdlib "tomllib" library
(which is self-contained, four files, uses type annotations) instead of
on very small bits of handwritten code.

Also remove the `without_parse` benchmark: now that we are running on
real code that uses typeshed, we'd either have to pre-parse all of
typeshed (slow) or find some way to determine which typeshed modules
will be used by the benchmark (not feasible with reasonable complexity.)

## Test Plan

`cargo bench -p ruff_benchmark --bench red_knot`
2024-08-02 11:23:52 -07:00
Micha Reiser 71f7aa4971 Remove criterion/codspeed compat layer (#12524) 2024-07-26 12:22:16 +02:00
Micha Reiser ed1b4122d0 Use Codspeed for continous benchmarking (#6896) 2023-08-26 16:34:35 +02:00
Charlie Marsh 19c4b7bee6 Rename ruff_python_semantic's Context struct to SemanticModel (#4565) 2023-05-22 02:35:03 +00:00
Micha Reiser 87fab4a2e1 Benchmark all rules (#3570) 2023-03-17 19:29:39 +01:00
Micha Reiser d5700d7c69 Add Micro Benchmark (#3466) 2023-03-14 08:35:07 +01:00