Skip to content

Comments

Improve Python uninstall perf by removing unnecessary call to installations.find_all()#14180

Merged
jtfmumm merged 1 commit intomainfrom
jtfm/speed-up-uninstall
Jun 23, 2025
Merged

Improve Python uninstall perf by removing unnecessary call to installations.find_all()#14180
jtfmumm merged 1 commit intomainfrom
jtfm/speed-up-uninstall

Conversation

@jtfmumm
Copy link
Contributor

@jtfmumm jtfmumm commented Jun 21, 2025

#13954 introduced an unnecessary slow-down to Python uninstall by calling installations.find_all() to discover remaining installations after an uninstall. Instead, we can filter all initial installations against those in uninstalled.

As part of this change, I've updated uninstalled from a Vec to an IndexSet in order to do efficient lookups in the filter. This required a change I call out below to how we were retrieving them for messaging.

@jtfmumm jtfmumm added the performance Potential performance improvement label Jun 21, 2025
// Report on any uninstalled installations.
if !uninstalled.is_empty() {
if let [uninstalled] = uninstalled.as_slice() {
if let Some(first_uninstalled) = uninstalled.first() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The destructuring approach no longer works now that this is an IndexSet instead of a Vec.

@jtfmumm jtfmumm force-pushed the jtfm/speed-up-uninstall branch from 12253b5 to 4bfcc89 Compare June 23, 2025 06:52
@jtfmumm jtfmumm temporarily deployed to uv-test-registries June 23, 2025 06:55 — with GitHub Actions Inactive
@jtfmumm jtfmumm added internal A refactor or improvement that is not user-facing and removed performance Potential performance improvement labels Jun 23, 2025
@Gankra
Copy link
Contributor

Gankra commented Jun 23, 2025

Nice catch!

@jtfmumm jtfmumm merged commit b06dec8 into main Jun 23, 2025
87 checks passed
@jtfmumm jtfmumm deleted the jtfm/speed-up-uninstall branch June 23, 2025 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal A refactor or improvement that is not user-facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants