From 95191c1304e78531cc9a382dc8cd3a044ae32455 Mon Sep 17 00:00:00 2001 From: Kevin Turcios Date: Mon, 29 Jun 2026 13:01:50 -0500 Subject: [PATCH 1/2] perf(cache): reuse supported tag set for wheel cache --- news/14122.bugfix.rst | 2 ++ src/pip/_internal/cache.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 news/14122.bugfix.rst diff --git a/news/14122.bugfix.rst b/news/14122.bugfix.rst new file mode 100644 index 0000000000..616f6bb6a5 --- /dev/null +++ b/news/14122.bugfix.rst @@ -0,0 +1,2 @@ +Improve cached wheel lookup performance when many cached wheels are checked +against the same supported tags. diff --git a/src/pip/_internal/cache.py b/src/pip/_internal/cache.py index 0bcb697542..da2f8eb783 100644 --- a/src/pip/_internal/cache.py +++ b/src/pip/_internal/cache.py @@ -138,6 +138,7 @@ def get( return link canonical_package_name = canonicalize_name(package_name) + supported_tags_set = set(supported_tags) for wheel_name, wheel_dir in self._get_candidates(link, canonical_package_name): try: wheel = Wheel(wheel_name) @@ -152,7 +153,7 @@ def get( package_name, ) continue - if not wheel.supported(supported_tags): + if not wheel.supported(supported_tags_set): # Built for a different python/arch/etc continue candidates.append( From 9e6bb7015fdac7d0601badf1bb9c454c2f447b8e Mon Sep 17 00:00:00 2001 From: Kevin Turcios <106575910+KRRT7@users.noreply.github.com> Date: Tue, 30 Jun 2026 17:37:27 -0500 Subject: [PATCH 2/2] Update news/14122.bugfix.rst Co-authored-by: Richard Si --- news/14122.bugfix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/14122.bugfix.rst b/news/14122.bugfix.rst index 616f6bb6a5..9d0f2e986a 100644 --- a/news/14122.bugfix.rst +++ b/news/14122.bugfix.rst @@ -1,2 +1,2 @@ Improve cached wheel lookup performance when many cached wheels are checked -against the same supported tags. +for compatibility.