←back to thread

741 points chirau | 6 comments | | HN request time: 0s | source | bottom
1. AJRF ◴[] No.44358870[source]
Is there something inheret about rust that means its faster at dep resolution than Python? Like where is the speed up coming from?

Or would it be possible to go this fast in python if you cared enough about speed?

Is it a specific thing that rust has an amazing library for? Like Network or SerDe or something?

replies(2): >>44358890 #>>44358912 #
2. tcdent ◴[] No.44358890[source]
They came up with a faster resolution algorithm, in addition to implementing it in a faster language.

pip could be made faster based on this, but maybe not quite as fast.

replies(1): >>44359256 #
3. simonw ◴[] No.44358912[source]
The biggest speed-up in uv comes from the way it uses caching and hard links. When you install a package into a virtual environment uv uses a hard link to a previously cached version rather than copying files.

Using Rust is responsible for a lot of speed gains too, but I believe it's the hard linking trick (which could be implemented in any language) that's the biggest win.

replies(1): >>44365127 #
4. _bent ◴[] No.44359256[source]
The resolution algorithm is the pubgrub algorithm from Darts package manager pub, implemented in Rust for Cargo https://youtu.be/LGXx5Bqcgq8
replies(1): >>44363851 #
5. ◴[] No.44363851{3}[source]
6. aragilar ◴[] No.44365127[source]
There's also the assumptions around wheels having consistent metadata (which isn't required in older versions of the specs), so as long as you don't need to support the long tail of packages, then those assumptions are fine (it's worth noting uv weren't the first to make these assumptions, poetry did this too, but pip does not).