Skip to content

Commit 84a052e

Browse files
authored
Merge pull request #12873 from man-group/perf-requirement-cache-size
PERF: get_requirement() raise cache from 2048 to 8192 elements
2 parents 7eb71fa + af8e28e commit 84a052e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

news/12873.feature.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Minor performance improvement when installing packages with a large number
2+
of dependencies by increasing the requirement string cache size.

src/pip/_internal/utils/packaging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def check_requires_python(
3535
return python_version in requires_python_specifier
3636

3737

38-
@functools.lru_cache(maxsize=2048)
38+
@functools.lru_cache(maxsize=10000)
3939
def get_requirement(req_string: str) -> Requirement:
4040
"""Construct a packaging.Requirement object with caching"""
4141
# Parsing requirement strings is expensive, and is also expected to happen

0 commit comments

Comments
 (0)