On 31/07/2024 01:06, Lynn McGuire wrote:
"Python is 71x Slower, Uses 75x More Energy, Than C" - YouTube
https://www.youtube.com/watch?v=U4c6nFGt1iM
Could that guy's voice be any more annoying?
Anyway, some observations:
* CPython (I assume this is Cpython), is of course just a program
written in C. So it's really just a C application ...
* The C results are going to be mostly thanks to the efforts of
aggressively optimising compilers, rather than the language itself. I
guess they weren't using Tiny C!
* The test programs are all from the computer language benchmarks game,
which are mostly useless for comparisons. Because entries can choose
their own algorithms, employ multi-threading etc. So it's no surprise
there is such a wide range of results.
* When Python is used for a one-off program that runs in a fraction of a second, the fact that is is 70 times slower than the C equivalent is irrelevant. But if you include the build-time for the C, then the Python
may well have used fewer machine resources.
I am not buying that C++ is slower than Rust.
The referenced paper is:
https://www.sciencedirect.com/science/article/abs/pii/S0167642321000022
It's the computer benchmarks game; I wouldn't pay too much attention.
When I once tested of its programs ('fannkuch') I got these results,
although they are several years old (3 out of 24 shown):
Clang -O3 2.45 secs
Rustc -O 3.2
Tiny C 10.1
Rustc 37.8
Rust in debug mode ran a magnitude slower than optimised releae mode.
Maybe it was interpreted? I never found out why.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)