Latest Results
[ty] Make dataclass `own_fields` a `salsa::tracked` method (#24620)
## Summary
The lack of memoization here is leading to O(N^2) in at least one
dataclass operation. If you trace `check_class`, we iterate over each
member; then for dataclasses, for each member, we call
`is_own_dataclass_instance_field`, which in turn calls
`self.own_fields`. So for every member, we're re-creating the entire
member map.
I asked Codex to do some benchmarking -- here, with 1,000 fields:
| Metric | Before | After |
|---|---:|---:|
| Wall time | 5.65s | 0.545s |
| Max RSS | 113.45 MB | 87.52 MB |
| Salsa memory report | 51.30 MB | 27.65 MB |
If you increase to multiple thousands of fields, it generally doesn't
finish on main (but takes ~1 second on this branch).
As an alternative, we could rewrite the `check_class` pipeline to avoid
the O(N^2) behavior, though we may end up just chasing down other usage
sites (e.g., Codex suggests that `list_member.srs` also suffers from
this as-is).
Closes https://github.com/astral-sh/ty/issues/3190. Latest Branches
0%
0%
0%
© 2026 CodSpeed Technology