3 ms·
I don’t believe orders of magnitude is achievable in general. Even python, which is perhaps the slowest mainstream language clocks in at around 10x that of C.
by kaba0 4y ago
I don’t believe orders of magnitude is achievable in general. Even python, which is perhaps the slowest mainstream language clocks in at around 10x that of C.
Sure, there will be some specialized program where keeping the cache manually small you can achieve big improvements, but most mainstream managed languages have very great performance. The slowdown is caused by the frameworks and whatnot, not the language itself.
- tcfhgj 4y agoI tried counting a large amount of numbers based on a condition in a loop. 70 times difference between python3 and cargo run --release
- kaba0 4y agoThat’s a tiny as hell microbenchmark though, where rust likely was able to vectorize even. The difference won’t be as drastic for larger (more meaningful) applications.
- pclmulqdq 4y agoPython programs often need to use a lot of optimized C and C++ libraries to get anywhere near reasonable performance. I would be shocked if a webserver written in Python was only 10x slower than one written in C (or Go or Rust for that matter).
- xigoi 4y agoAccording to these benchmarks, pure Python is about 100 times slower than C and other fast languages: https://github.com/kostya/benchmarks https://github.com/kostya/benchmarks
- igouy 4y agoGuess it depends what you mean by "achievable in general". Guess we don't have a way to measure "in general" so we are left with tiny tiny benchmarks programs. simple https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/simple.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... cpu secs Python 3 versus C gcc https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/python3-gcc.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...