Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PERF: get_requirement() raise cache from 2048 to 8192 elements #12873

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions news/12873.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Improve pip install performance.
Increase lru cache for parsing requirement strings from 2048 to 8192 items.
The small size was suboptimal when installing hundreds of packages.
2 changes: 1 addition & 1 deletion src/pip/_internal/utils/packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def check_requires_python(
return python_version in requires_python_specifier


@functools.lru_cache(maxsize=2048)
@functools.lru_cache(maxsize=8192)
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
Expand Down
Loading