From 29e0e689a72f24843342da56563aa1fe6b2f4bfe Mon Sep 17 00:00:00 2001 From: rmorotti Date: Tue, 23 Jul 2024 12:05:15 +0100 Subject: [PATCH 1/3] PERF: get_requirement() raise cache from 2048 to 8192 elements small performance improvements when installing hundreds of packages. --- src/pip/_internal/utils/packaging.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pip/_internal/utils/packaging.py b/src/pip/_internal/utils/packaging.py index caad70f7fd1..5bac550d723 100644 --- a/src/pip/_internal/utils/packaging.py +++ b/src/pip/_internal/utils/packaging.py @@ -35,7 +35,7 @@ def check_requires_python( return python_version in requires_python_specifier -@functools.lru_cache(maxsize=2048) +@functools.lru_cache(maxsize=10000) def get_requirement(req_string: str) -> Requirement: """Construct a packaging.Requirement object with caching""" # Parsing requirement strings is expensive, and is also expected to happen From 3634e872fef7afd37db87f5ae3b07150f9b7084f Mon Sep 17 00:00:00 2001 From: rmorotti Date: Tue, 23 Jul 2024 12:36:50 +0100 Subject: [PATCH 2/3] add news item --- news/12873.feature.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 news/12873.feature.rst diff --git a/news/12873.feature.rst b/news/12873.feature.rst new file mode 100644 index 00000000000..e982c3ee05e --- /dev/null +++ b/news/12873.feature.rst @@ -0,0 +1,2 @@ +Minor performance improvement when installing packages with a large number +of dependencies by increasing the requirement string cache size. \ No newline at end of file From af8e28ec19a71746fa55eaafd1f820bd9728fc58 Mon Sep 17 00:00:00 2001 From: rmorotti Date: Thu, 20 Mar 2025 13:31:54 +0000 Subject: [PATCH 3/3] news item need an empty line --- news/12873.feature.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/12873.feature.rst b/news/12873.feature.rst index e982c3ee05e..440fecc1d9f 100644 --- a/news/12873.feature.rst +++ b/news/12873.feature.rst @@ -1,2 +1,2 @@ Minor performance improvement when installing packages with a large number -of dependencies by increasing the requirement string cache size. \ No newline at end of file +of dependencies by increasing the requirement string cache size.