pyodide / micropip

A lightweight Python package installer for Pyodide
https://micropip.pyodide.org
Mozilla Public License 2.0
68 stars 16 forks source link

Optimize the speed of parsing and comparing Versions #73

Open ryanking13 opened 11 months ago

ryanking13 commented 11 months ago

We parse and compare versions lots of times when searching for an appropriate package, but parsing and comparing Version (packaging.version.Version) is quite expensive.

See: https://github.com/pyodide/micropip/pull/71#issuecomment-1630859157

So it would be nice to do some micro-optimizations for handling versions, such as (https://github.com/pyodide/micropip/pull/71#discussion_r1259764043):

If we want to go faster (no need to do it, just an idea). We can probably also subclass Version to something that has a frozen str and hash so it doesn't need to be re-computed at each dict comparison.