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.
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.
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):