mirror of
https://github.com/astral-sh/ruff
synced 2026-01-22 05:51:03 -05:00
It turns out this wasn't actually doing much and was just papering over the possibility of duplicates being returned from `SemanticModel`. So this was doing a fair bit of work for no good reason. Instead, we push deduplication down into semantic completions directly. This will run over a (typically) much smaller number of completions. With that said, this doesn't seem to lead to improvement in ad hoc benchmarking. However, perf wasn't really the main motivation here: this change is primarily to prep for switching to a max-heap. This deduplication was problematic because it was being done *after* sorting, which meant it dependend on having the entire set of completions in memory. But with a max-heap, we'll only keep around the top-K completions, so deduplication has to be done "earlier" (if at all).