zlacker

[parent] [thread] 2 comments
1. Chilin+(OP)[view] [source] 2025-02-17 16:45:50
I like Rust as much as the next guy, but statements like this makes me roll my eyes:

> hk is written in rust, pre-commit is written in python. hk will be much faster.

I have no idea how fast hk or pre-commit is, i have never used them. What matters to speed is the algorithms used and their complexities. If you implement a shitty algorithm with exponential complexity in Rust it's going to be slower than a linear complexity algorithm in python.

replies(1): >>jitl+Yd
2. jitl+Yd[view] [source] 2025-02-17 18:03:52
>>Chilin+(OP)
This isn't true when it comes to CLI tools, where fixed costs and warm-up time can easily dominate over algorithmic complexity, especially comparing a scripting language to an ahead-of-time language. Without careful construction, a tool written in python with whatever O(log(n)) time complexity may still be booting up by the time a Rust tool finishes the job in O(n^2) time: frequently n is actually pretty small outside whole-repo builds, and the cost of interpreter is high especially with accompanying tooling -- python3 itself will run `print("hello")` on my machine in 40ms, but when wrapped in pyenv (which I think is typical?) it takes 400ms. The same goes for node/npx and ruby/bundle. Compare to an ahead-of-time compiled binary from go, which can boot and print hello in 3ms on my machine -- it has between 10x to 100x the wallclock budget the python program just spends booting up.
replies(1): >>tralln+3m
◧◩
3. tralln+3m[view] [source] [discussion] 2025-02-17 18:59:12
>>jitl+Yd
These days I'd say tools pipx (and now also uv) are far more common than pyenv for tool management
[go to top]