Avatar for the astral-sh user
astral-sh
ruff
BlogDocsChangelog

[ty] improve complex TDD-based narrowing

#23201Closed
Comparing
mtshiba:improve-23109
(
ff76ba0
) with
main
(
85a6a44
)
CodSpeed Performance Gauge
+20%
Improvement
1
Untouched
53
New
1

Benchmarks

55 total
pydantic
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
+20%
7.4 s6.1 s
ty_micro[large_union_narrowing]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_large_union_narrowing
CodSpeed Performance Gauge
N/A
N/A296.8 ms
multithreaded
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
-3%
1.3 s1.3 s
ty_micro[many_enum_members]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_many_enum_members
CodSpeed Performance Gauge
-3%
128 ms131.9 ms
ty_micro[many_string_assignments]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_many_string_assignments
CodSpeed Performance Gauge
-2%
78.1 ms80.1 ms
freqtrade
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
-2%
9.2 s9.4 s
ty_check_file[cold]
crates/ruff_benchmark/benches/ty.rs::check_file::benchmark_cold
CodSpeed Performance Gauge
-2%
147.6 ms150.9 ms
attrs
crates/ruff_benchmark/benches/ty.rs::project::attrs::project
CodSpeed Performance Gauge
-2%
478.4 ms486.7 ms
ty_micro[many_tuple_assignments]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_tuple_implicit_instance_attributes
CodSpeed Performance Gauge
-2%
68.1 ms69.2 ms
pandas
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
-1%
82 s83.2 s
ty_micro[very_large_tuple]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_very_large_tuple
CodSpeed Performance Gauge
-1%
69.9 ms70.9 ms
ty_check_file[incremental]
crates/ruff_benchmark/benches/ty.rs::check_file::benchmark_incremental
CodSpeed Performance Gauge
-1%
8.1 ms8.2 ms
ty_micro[complex_constrained_attributes_3]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_complex_constrained_attributes_3
CodSpeed Performance Gauge
-1%
74.1 ms75.1 ms
ty_micro[many_enum_members_2]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_many_enum_members_2
CodSpeed Performance Gauge
-1%
162.7 ms164.7 ms
ty_micro[many_tuple_assignments]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_many_tuple_assignments
CodSpeed Performance Gauge
-1%
66 ms66.8 ms
static_frame
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
-1%
31 s31.3 s
ty_micro[complex_constrained_attributes_2]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_complex_constrained_attributes_2
CodSpeed Performance Gauge
-1%
68.6 ms69.2 ms
ty_micro[complex_constrained_attributes_1]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_complex_constrained_attributes_1
CodSpeed Performance Gauge
-1%
68.4 ms69.1 ms
tanjun
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
-1%
2.8 s2.8 s
DateType
crates/ruff_benchmark/benches/ty.rs::project::datetype::project
CodSpeed Performance Gauge
-1%
215.1 ms216.4 ms
colour_science
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
-1%
129.6 s130.3 s
sympy
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
0%
68.5 s68.8 s
anyio
crates/ruff_benchmark/benches/ty.rs::project::anyio::project
CodSpeed Performance Gauge
0%
1.2 s1.2 s
altair
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
0%
4.9 s4.9 s
lexer[numpy/globals.py]
crates/ruff_benchmark/benches/lexer.rs::lexer::benchmark_lexer
CodSpeed Performance Gauge
0%
30.4 µs30.3 µs

Commits

Click on a commit to change the comparison range
Base
main
85a6a44
-51.09%
[ty] improve #23109 TDD-based narrowing
c6ad1e8
6 months ago
by mtshiba
+44%
cache `narrow_by_constraint_inner`
989268d
6 months ago
by mtshiba
+0.16%
further `narrow_by_constraint_inner` optimization
f92287c
6 months ago
by mtshiba
+0.71%
further `narrow_by_constraint_inner` optimization (take 2)
0e2ca45
6 months ago
by mtshiba
-1.01%
Revert "further `narrow_by_constraint_inner` optimization (take 2)"
8369501
6 months ago
by mtshiba
-0.23%
Reapply "improve constant calculations with `resolve_to_literal`"
b2e63ce
6 months ago
by mtshiba
-2.6%
Update place_state.rs
946ea42
6 months ago
by mtshiba
+0.02%
Revert "`narrow_by_constraint` optimization (take 3)"
f10df50
6 months ago
by mtshiba
-0.31%
add `PlaceVersion` to prevent the old shadowed narrowing constraint from being applied
4eb12c8
6 months ago
by mtshiba
+2.36%
`narrow_by_constraint` optimization using `PlaceVersion`
19e63c4
5 months ago
by mtshiba
-0.15%
`narrow_by_constraint` optimization using `UnionType::from_elements_without_redundancy_check`
50fc1e9
5 months ago
by mtshiba
+0.93%
optimization in `PredicatePlaceVersionInfo`
41059e9
5 months ago
by mtshiba
+0.1%
remove `ReturnsNever` special casing
cd6c0ef
5 months ago
by mtshiba
+0.89%
remove `all_negative_narrowing_constraints_for_{expression, pattern}`
8468a9e
5 months ago
by mtshiba
-0.29%
compact `PredicatePlaceVersions`
c2fe06e
5 months ago
by mtshiba
+0.8%
store place versions per definition in `UseDefMap`
3c0be32
5 months ago
by mtshiba
-0.24%
remove `latest_place_version` from `Bindings`
9142acd
5 months ago
by mtshiba
-1.39%
intern `bindings_by_use`
b0add5e
5 months ago
by mtshiba
+0.78%
Update narrow.rs
432e7d4
5 months ago
by mtshiba
-0.53%
fix `L/RShift` implemenation in `resolve_to_literal`
8bff224
5 months ago
by mtshiba
-1.69%
Revert "remove `latest_place_version` from `Bindings`"
04dfb49
5 months ago
by mtshiba
+0.82%
Merge branch 'main' into improve-23109
99ad21f
5 months ago
by mtshiba
+2.06%
remove unnecessary code
65bdd1c
5 months ago
by mtshiba
-1.44%
simplify `narrow_by_constraint_inner` logic
c1c0757
5 months ago
by mtshiba
-1.43%
reduce redundancy checks in `narrow_by_constraint`
3edbfdf
5 months ago
by mtshiba
+0.9%
reduce redundancy checks in `narrow_by_constraint` (2)
56dd816
5 months ago
by mtshiba
+1.57%
memorize all return values in `narrow_by_constraint_inner`
3e05314
5 months ago
by mtshiba
-0.56%
narrowing constraint id canonicalization
6b11b17
5 months ago
by mtshiba
-0.66%
[ty] Propagate narrowing through always-true if-conditions
c171e96
5 months ago
by mtshiba
+1.1%
Update reachability_constraints.rs
4b1398c
5 months ago
by mtshiba
-6.32%
disable non-effective cache
5d984f4
5 months ago
by mtshiba
-2.68%
disable non-effective cache (take 2)
7e82288
5 months ago
by mtshiba
+8.77%
Revert "disable non-effective cache (take 2)"
56c5011
5 months ago
by mtshiba
+4.76%
cache two types intersection as a tracked function
738cf8d
5 months ago
by mtshiba
-4.07%
`NarrowingConstraint` has `Cunjunction`s
a1e303e
5 months ago
by mtshiba
-1.82%
add `GatedNarrowingConstraint`
2c8bade
5 months ago
by mtshiba
+3.02%
Merge branch 'main' into improve-23109
3d60f3f
5 months ago
by mtshiba
-2.56%
revert `add `GatedNarrowingConstraint``
a596400
5 months ago
by mtshiba
+0.36%
cache two types union as a tracked function
fb05c74
5 months ago
by mtshiba
+0.83%
Revert "cache two types union as a tracked function"
f476d36
5 months ago
by mtshiba
+24.07%
cache two types intersection as a tracked function (take 2)
50c976c
5 months ago
by mtshiba
+3.51%
use `IntersectionType::from_two_elements` more
adb4472
5 months ago
by mtshiba
-0.42%
add fast path for intersection type redundancy check
5c321a0
5 months ago
by mtshiba
+0.9%
avoid expensive intersection type checks
9363927
5 months ago
by mtshiba
+0.19%
add benchmark for large union type narrowing
1c8120b
5 months ago
by mtshiba
-0.26%
Merge branch 'main' into improve-23109
71f41f1
5 months ago
by mtshiba
-0.43%
remove unnecessary code
64d2a86
5 months ago
by mtshiba
+0.23%
Revert "remove unnecessary code"
c913247
5 months ago
by mtshiba
-25.92%
add `MAX_NARROWING_GATING_MERGES`
0030056
5 months ago
by mtshiba
+4.07%
Revert "add `MAX_NARROWING_GATING_MERGES`"
9623224
5 months ago
by mtshiba
+23.54%
more aggressive short circuit in `Bindings::merge`
a82538c
5 months ago
by mtshiba
-0.58%
optimize `narrow_by_constraint_inner`
52c4104
5 months ago
by mtshiba
+0.27%
Merge branch 'main' into improve-23109
27e5778
5 months ago
by mtshiba
-0.36%
experiment: revert "optimize `narrow_by_constraint_inner`"
736aeeb
5 months ago
by mtshiba
+1.83%
Revert "experiment: revert "optimize `narrow_by_constraint_inner`""
4f2ce84
5 months ago
by mtshiba
-1.32%
tracked `evaluate_constraint_type`
89eb8f9
5 months ago
by mtshiba
+1.38%
Revert "tracked `evaluate_constraint_type`"
f251ccb
5 months ago
by mtshiba
-4.75%
Update narrow.rs
ff76ba0
5 months ago
by mtshiba
© 2026 CodSpeed Technology
Home Terms Privacy Docs