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

Canonicalize version is slow and needs to be called a lot by Pip, but can't easily be cached externally #729

Open
notatallshaw opened this issue Oct 6, 2023 · 0 comments

Comments

@notatallshaw
Copy link

notatallshaw commented Oct 6, 2023

I've been investigating performance issue in Pip reported here: pypa/pip#12314

I've created a fork that caches as many calls to packaging from Pip as I can easily implement.

However one of the biggest performance issues, taking 30% of the runtime of this example on my forked version of Pip, is canonicalize_version, unfortunately it is not called directly by pip but instead called by _canonical_spec, which is called by _IndividualSpecifier.__eq__ which is called by SpecifierSet.__eq__ which is called by two different sites in Pip.

It seems caching Pip's calls to SpecifierSet.__eq__ is ineffective as there are far more SpecifierSet value pairs than values returned by canonicalize_version.

I do not have an obvious solution at this time, but I wanted to bring this to your attention in case I am missing something.

@notatallshaw notatallshaw changed the title Canonicalize version is slow and needs to be called a lot, but can't easily be cached externally Canonicalize version is slow and needs to be called a lot by Pip, but can't easily be cached externally Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants