Top
Best
New

Posted by zdw 1 day ago

How uv got so fast(nesbitt.io)
1156 points | 396 commentspage 5
dmarwicke 17 hours ago|
wait, zero-copy deserialization isn't rust-specific. you can mmap structs in C. done it before, works fine
zahlman 14 hours ago|
The point is that it would be difficult in Python, compared to in "system" compiled languages generally.
TrayKnots 11 hours ago||
I usually don't see the importance of speed in one-time costs... But hey, same discussion with npm, yarn, pnpm...
agumonkey 1 day ago||
very nice article, always good to get a review of what a "simple" looking tool does behind the scense

about rust though

some say a nicer language helps finding the right architecture (heard that about cpp veteran dropping it for ocaml, any attempted idea would take weeks in cpp, was a few days in ocaml, they could explore more)

also the parallelism might be a benefit the language orientation

enough semi fanboyism

IshKebab 23 hours ago||
Mmm I don't buy it. Not many projects use setup.py now anyway and pip is still super slow.

> Plenty of tools are written in Rust without being notably fast.

This also hasn't been my experience. Most tools written in Rust are notably fast.

zahlman 23 hours ago||
> Not many projects use setup.py now anyway and pip is still super slow.

Yes, but that's still largely not because of being written in Python. The architecture is really just that bad. Any run of pip that touches the network will end up importing more than 500 modules and a lot of that code will simply not be used.

For example, one of the major dependencies is Rich, which includes things like a 3600-entry mapping of string names to emoji; Rich in turn depends on Pygments which normally includes a bunch of rules for syntax highlighting in dozens of programming languages (but this year they've finished trimming those parts of the vendored Pygments).

Another thing is that pip's cache is an HTTP cache. It literally doesn't know how to access its own package download cache without hitting the network, and it does that access through wrappers that rely on cachecontrol and Requests.

IshKebab 12 hours ago||
> Any run of pip that touches the network will end up importing more than 500 modules and a lot of that code will simply not be used.

That's a property of Python though. The fact that it isn't compiled (and that importing is very slow).

> a 3600-entry mapping of string names to emoji

Which can easily be zero-cost in Rust.

> It literally doesn't know how to access its own package download cache without hitting the network

This is the only example you've given that actually fits with your thesis.

zahlman 2 hours ago||
> That's a property of Python though. The fact that it isn't compiled (and that importing is very slow).

Bytecode compilation is compilation.

There are many things that could be used to improve import speed that I never even see discussed, let alone implemented.

But most importantly, pip doesn't need to have all these modules imported. They already proved they could defer the Requests imports; but the actual network calls aren't that hard to do with the standard library anyway. (As nice as it would be to have Requests in the standard library, but I digress.) Most of the stuff it imports up-front from Rich will go entirely unused.

> Which can easily be zero-cost in Rust.

Which is irrelevant to the point.

> This is the only example you've given that actually fits with your thesis.

No. My thesis is that pip doesn't have to be the way it is in order to actually solve the problem of installing Python packages. Everything I mentioned is an example of a thing pip doesn't have to do in order to install packages, and slows it down unnecessarily.

scottlamb 23 hours ago||
Mine either. Choosing Rust by no means guarantees your tool will be fast—you can of course still screw it up with poor algorithms. But I think most people who choose Rust do so in part because they aspire for their tool to be "blazing fast". Memory safety is a big factor of course, but if you didn't care about performance, you might have gotten that via a GCed (and likely also interpreted or JITed or at least non-LLVM-backend) language.
IshKebab 12 hours ago||
Yeah sometimes you get surprisingly fast Python programs or surprisingly slow Rust programs, but if you put in a normal amount of effort then in the vast majority of cases Rust is going to be 10-200x faster.

I actually rewrote a non-trivial Python program in Rust once because it was so slow (among other reasons), and got a 50x speedup. It was mostly just running regexes over logs too, which is the sort of thing Python people say is an ideal case (because it's mostly IO or implemented in C).

hallvard 1 day ago||
Great post, but the blatant chatgpt-esque feel hits hard… Don’t get me wrong, I love astral! and the content, but…
hallvard 1 day ago|
Reading the other replies here makes it really obvious that this is some LLM’s writing. Maybe even all of it…
aswegs8 1 day ago||
uv seems to be a pet peeve of HN. I always thought pipenv was good but yeah, seems like I was being ignorant
aw1621107 1 day ago||
> uv seems to be a pet peeve of HN.

Unless I've been seeing very different submissions than you, "pet peeve" seems like the exact opposite of what is actually the case?

VerifiedReports 1 day ago||
Indeed; I don't think he knows what "peeve" means...
glaucon 1 day ago|||
I too use pipenv unless there's a reason not to. I hope people use whatever works best for them.

I feel that sometimes there's a desire on the part of those who use tool X that everyone should use tool X. For some types of technology (car seat belts, antibiotics...) that might be reasonable but otherwise it seems more like a desire for validation of the advocate's own choice.

EdwardDiego 21 hours ago|||
My biggest complaint with pipenv is/was(?) that it's lockfile format only kept the platform identifiers of the platform you locked it on - so if you created it on Mac, then tried to install from the lockfile on a Linux box, you're building from source because it's only locked in wheels for MacOS.

Poetry and uv avoid this issue.

jlubawy 17 hours ago||
Came here to ask about pipenv. As someone who does not use python other than for scripting, but also appreciates the reproduceability that pipenv provides, should I be using uv? My understanding is that pipenv is the better successor to venv and pip (combined), but now everyone is talking about uv so to be honest it's quite confusing.

Edit: to add to what my understanding of pipenv is, the "standard/approved" method of package management by the python community, but in practice is it not? Is it now uv?

pjjpo 15 hours ago||
> npm’s package.json is declarative

lol

pkaodev 23 hours ago||
AI slop
man4 16 hours ago||
[dead]
rvz 23 hours ago|
TLDR: Because Rust.

This entire AI generated article with lots of text just to just say the obvious.

zahlman 22 hours ago|
That conclusion is largely false, and is not what the article says.
More comments...