ruff
77c28c03 - [ty] Walk protocol interfaces in member order (#26996)

Commit
28 days ago
[ty] Walk protocol interfaces in member order (#26996) We reduce repeated `BTreeMap` lookups when comparing similarly sized protocol interfaces by walking source members in name order. The walk remains lazy and restarts when structural-priority ordering returns to an earlier member name, preserving early failure and recursive constraint ordering. When the source has more than twice as many members as the target, we keep direct lookups so small target interfaces do not require scanning a large source. CodSpeed reports a [4.98% efficiency improvement](https://github.com/astral-sh/ruff/pull/26996#issuecomment-5017613608) for `many_protocol_members_mismatch` in simulation, with no reported regressions among the other comparable benchmarks. This is a focused microbenchmark result. The new dense, sparse, early-mismatch, and mixed-priority benchmarks have no comparative baseline yet; local native timings were inconclusive.
Author
Parents
Loading