zlacker

[return to "Hk, a new Git hook manager"]
1. Chilin+94[view] [source] 2025-02-17 16:45:50
>>DrBenC+(OP)
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.

◧◩
2. jitl+7i[view] [source] 2025-02-17 18:03:52
>>Chilin+94
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.
[go to top]