Skip to content

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

Open
@notatallshaw

Description

@notatallshaw

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions