Python Speed Comparison: Faster Than We Thought?!

preview_player
Показать описание
Today we compare Python's execution speed with that of Java, C, Go, R and JavaScript, to determine, which language is the fastest or the slowest. When considering all aspects, the results might surprise you.

◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚

🌐 Social Media & Contact 🌐

Timestamps:
(0:00) Intro
(0:22) Bixly
(1:27) Simple Task Comparison
(12:12) Complex Task Comparison
(23:13) Outro
Рекомендации по теме
Комментарии
Автор

i swear this guy never checks comments and is literally never online in his discord at all. its like he makes a video then goes to narnia

veroxsity
Автор

You should also mention that other implementations are faster then others, some like PyPy which has a just in time compiler option can optimize code a crazy amount.

tips
Автор

With the -Ox compilation option enabled in C++, the code would execute instantly (close to zero) since the compiler would recognize that the variable "sum" is never accessed and has no side effects. Consequently, your code would simply become "int main() {//nothing here}". If your code did access "sum, " for example, by printing it out using "cout << sum, " the compiler would optimize it to "cout << and remove the loop entirely, as it knows the result beforehand. This optimization would result in zero runtime performance cost. Remember, the fastest code is the code you never have to run. This is why compiled languages are generally faster. Some scripting languages do have JIT (Just-in-Time) compilers invoked at runtime, which often generate faster code for the same reasons as C++ or other ahead-of-time compiled languages. I mention this because, in real-world situations, the effect would be a significantly faster-running program, and "main.c" would take zero time to execute.

Richmar
Автор

This test wasnt fair for Java and Go. Go had the build included in the time when it could have just been running the binary, and Java was not compiled to a .class file so of course it would be much slower in interpreted mode.

NewLondonMarshall
Автор

You should've done go build and then execute the binary produced. That would've been faster

AbhishekBM
Автор

It is true that python is slower at execution, but to have high performance, it is often recommended to use built-in functions (programmed in C) like sum in this case. With the speed will be increased.

leopoldtiotsop
Автор

the node js loop benchmark one errored, we didn't get the real result

kamalshkeir
Автор

Very nice video, thank you, and this operator you publish before as the most unknown is really awesome.

rons
Автор

How did you customize the windows and Linux terminals with the background images?

sunkanmiotitolaye
Автор

Javascript code was not executed actually. Because you've typed time node.main.js ...and got 'Command not found' error.

caju
Автор

Why are you not compiling the Java code via "javac Main.java" first and after that invoking the interpreter with "java Main"? By simply using "java Main.java" you are actually measuring compile time for generating the byte code plus execution time (you don't do that for your C code).

martingro
Автор

I hope you also talk about Cython, CPython, and other extensions for speed comparison.

SkyFly
Автор

Would you consider local pricing on your books in the future?

serkan_bayram
Автор

On my computer I get similar results for the python and C matrix time measurements. If I use -O3 to compile the C program it is 4 times faster than the python version

mikejohnston
Автор

Would be interesting to see how fast it is with Python 3.11.

Zwiesel
Автор

wow, thanks for sharing knowledge, subscibed.

aquaeyed
Автор

3.11 is faster than previous python versions.

nocopyrightgameplaystockvi
Автор

Why is it that you aren’t initializing the C array in the python using numpy like you are for the Java and the c?

alphabasic
Автор

can we compare same with 3.9 vs 3.11 i think there should be huge difference

muralir
Автор

is the @ in python really using that "k" loop too? just curious

lilcwn