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

[ty] improve complex TDD-based narrowing

#23201
Comparing
mtshiba:improve-23109
(
f251ccb
) with
main
(
66defe9
)
CodSpeed Performance Gauge
+25%
Improvement
1
Untouched
53
New
1

Benchmarks

55 total
pydantic
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
+25%
7.5 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/A293.9 ms
altair
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
+2%
5 s4.9 s
colour_science
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
+2%
131.2 s129 s
static_frame
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
+1%
31.9 s31.4 s
lexer[numpy/globals.py]
crates/ruff_benchmark/benches/lexer.rs::lexer::benchmark_lexer
CodSpeed Performance Gauge
0%
30.3 µs30.2 µs
tanjun
crates/ruff_benchmark/benches/ty_walltime.rs
CodSpeed Performance Gauge
0%
2.8 s2.8 s
lexer[numpy/ctypeslib.py]
crates/ruff_benchmark/benches/lexer.rs::lexer::benchmark_lexer
CodSpeed Performance Gauge
0%
228.5 µs228.4 µs
lexer[unicode/pypinyin.py]
crates/ruff_benchmark/benches/lexer.rs::lexer::benchmark_lexer
CodSpeed Performance Gauge
0%
79.2 µs79.2 µs
parser[numpy/globals.py]
crates/ruff_benchmark/benches/parser.rs::parser::benchmark_parser
CodSpeed Performance Gauge
0%
109.2 µs109.2 µs
parser[unicode/pypinyin.py]
crates/ruff_benchmark/benches/parser.rs::parser::benchmark_parser
CodSpeed Performance Gauge
0%
329.8 µs329.7 µs
formatter[numpy/globals.py]
crates/ruff_benchmark/benches/formatter.rs::formatter::benchmark_formatter
CodSpeed Performance Gauge
0%
247.9 µs247.9 µs
lexer[pydantic/types.py]
crates/ruff_benchmark/benches/lexer.rs::lexer::benchmark_lexer
CodSpeed Performance Gauge
0%
511.2 µs511.1 µs
linter/default-rules[numpy/globals.py]
crates/ruff_benchmark/benches/linter.rs::default_rules::benchmark_default_rules
CodSpeed Performance Gauge
0%
211 µs211 µs
linter/default-rules[numpy/ctypeslib.py]
crates/ruff_benchmark/benches/linter.rs::default_rules::benchmark_default_rules
CodSpeed Performance Gauge
0%
1 ms1 ms
parser[numpy/ctypeslib.py]
crates/ruff_benchmark/benches/parser.rs::parser::benchmark_parser
CodSpeed Performance Gauge
0%
947.5 µs947.4 µs
linter/all-with-preview-rules[pydantic/types.py]
crates/ruff_benchmark/benches/linter.rs::preview_rules::benchmark_preview_rules
CodSpeed Performance Gauge
0%
10.3 ms10.3 ms
linter/all-rules[pydantic/types.py]
crates/ruff_benchmark/benches/linter.rs::all_rules::benchmark_all_rules
CodSpeed Performance Gauge
0%
8.7 ms8.7 ms
linter/default-rules[pydantic/types.py]
crates/ruff_benchmark/benches/linter.rs::default_rules::benchmark_default_rules
CodSpeed Performance Gauge
0%
2.2 ms2.2 ms
formatter[unicode/pypinyin.py]
crates/ruff_benchmark/benches/formatter.rs::formatter::benchmark_formatter
CodSpeed Performance Gauge
0%
688.2 µs688.2 µs
linter/default-rules[unicode/pypinyin.py]
crates/ruff_benchmark/benches/linter.rs::default_rules::benchmark_default_rules
CodSpeed Performance Gauge
0%
410.9 µs410.9 µs
lexer[large/dataset.py]
crates/ruff_benchmark/benches/lexer.rs::lexer::benchmark_lexer
CodSpeed Performance Gauge
0%
1.2 ms1.2 ms
parser[large/dataset.py]
crates/ruff_benchmark/benches/parser.rs::parser::benchmark_parser
CodSpeed Performance Gauge
0%
5.1 ms5.1 ms
parser[pydantic/types.py]
crates/ruff_benchmark/benches/parser.rs::parser::benchmark_parser
CodSpeed Performance Gauge
0%
2 ms2 ms
linter/all-rules[numpy/globals.py]
crates/ruff_benchmark/benches/linter.rs::all_rules::benchmark_all_rules
CodSpeed Performance Gauge
0%
744.1 µs744.1 µs

Commits

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