200M Speed Comparison :: Python Vs Rust | Closer To Machine Code

  Рет қаралды 7,070

Bek Brace

Bek Brace

Күн бұрын

Пікірлер: 45
@laabiditarek1122
@laabiditarek1122 8 ай бұрын
You can optimize the python code by setting count to 200000000 before the loop :)
@BekBrace
@BekBrace 8 ай бұрын
cool, a valid optimization suggestion but I don't think it will drastically change anything :)
@meqdaddev4341
@meqdaddev4341 8 ай бұрын
Python next feature: Implementing the Python popular packages using Rust with just a Python wrapper 🤣
@BekBrace
@BekBrace 8 ай бұрын
Nothing is impossible 😂
@BRISKLYHIDDEN
@BRISKLYHIDDEN 7 ай бұрын
😂😂😂
@timothyking3759
@timothyking3759 6 ай бұрын
rust: 0.70 seconds; matlab: 0.17s seconds here's the matlab code count = 0; startTime = tic; for i = [1:2*10^8] count = count +1; end toc(startTime)
@contentpump2537
@contentpump2537 8 ай бұрын
You even forgot to enable Optimizations on the Rust side, so it might be slightly to infinity faster depending on if the rust compiler can tell that the result is always going to be 200_000_000.
@BekBrace
@BekBrace 8 ай бұрын
So true (your second part of the statement), I haven't forgotten though, it was deliberately written this way.
@falkez1514
@falkez1514 8 ай бұрын
please post a video to tell us when python is done!
@BekBrace
@BekBrace 8 ай бұрын
😂😂😂
@BRISKLYHIDDEN
@BRISKLYHIDDEN 7 ай бұрын
😢
@ggsap
@ggsap 7 ай бұрын
This test is still taking into account the timing code. Instead use the time command. Also why no optimizations are enabled for rust?
@BekBrace
@BekBrace 7 ай бұрын
Thanks, I didn't know about optimization till a video later -_-
@vladyslav-py-js-cs
@vladyslav-py-js-cs 8 ай бұрын
It was predictable😂
@BekBrace
@BekBrace 8 ай бұрын
I want to test Haskell, C and Rust in the next one :)
@vladyslav-py-js-cs
@vladyslav-py-js-cs 8 ай бұрын
@@BekBrace Wanna see it😁 it's gonna be fun
@CosmicSilhouette
@CosmicSilhouette 8 ай бұрын
Since both C and rust are closer to machine than python will the difference in speed be minimal and more unpredictable?
@bekbraceplus
@bekbraceplus 8 ай бұрын
Absolutely true, I am doing that test this week, and for more spicy flavor I'll add Haskell to the game ! Stay Tuned!
@jaroslavhuss7813
@jaroslavhuss7813 7 ай бұрын
Here again, please, use --release flag with Rust... IT would be 0.0000000....
@BekBrace
@BekBrace 7 ай бұрын
Again, learnt that lately - thank you
@mr.michaelsomeone5667
@mr.michaelsomeone5667 8 ай бұрын
Use iterarors instead of "for" cycles in Rust
@BekBrace
@BekBrace 8 ай бұрын
Thank you, Michael, I will do in the next Test video 👍🙏
@andreasmastronikolis3987
@andreasmastronikolis3987 8 ай бұрын
just checked on my machine with c++ ... 0.05 seconds.
@BekBrace
@BekBrace 8 ай бұрын
What the .... 😲😲😲
@Maxawa0851
@Maxawa0851 8 ай бұрын
You sure the compiler didnt just optimize the loop with a count = 200000000?
@oskwon72
@oskwon72 8 ай бұрын
How about vs. Golang or vs. C++?
@BekBrace
@BekBrace 8 ай бұрын
I guess we'll figure out soon 😉
@lmnts556
@lmnts556 8 ай бұрын
Try to do it with cython or even numba.
@BekBrace
@BekBrace 8 ай бұрын
I should
@gustavojoaquin_arch
@gustavojoaquin_arch 8 ай бұрын
Heil Rust
@BekBrace
@BekBrace 8 ай бұрын
Hail to Rust 😁
@josephusophia
@josephusophia 8 ай бұрын
i don't think this comparison is fair especially rust is compiled and python is an interpreted language
@BekBrace
@BekBrace 8 ай бұрын
No it's not you're right, but just to show the difference 😉 Correction for you: Python is an interpreted language, true, but it's also compiled into bytecode which is done automatically and after execution. But still, doesn't help I know 😂. In the next one, I'll show you rust vs two other languages.
@josephusophia
@josephusophia 8 ай бұрын
@@BekBrace What about comparing production time over execution time ration When you calculate the time needed to write the code and divide it by the execution time. That would be very interesting
@BekBrace
@BekBrace 7 ай бұрын
​@@josephusophiaI'll do that between Rust, Node, C and Python
@waelmohameddd
@waelmohameddd 8 ай бұрын
Please C next video, man
@BekBrace
@BekBrace 8 ай бұрын
Done
@furiousmilk6559
@furiousmilk6559 8 ай бұрын
what abt c++ and rust?
@BekBrace
@BekBrace 8 ай бұрын
I have never coded in C++, however I do C and I'll make the next Test with C
@furiousmilk6559
@furiousmilk6559 8 ай бұрын
@@BekBrace nice, I've never tried rust but I could do a quick c++ to compare to your rust code iyw
@cloudcoder01
@cloudcoder01 8 ай бұрын
This is not fair .. where is Mojo🔥?!!!
@BekBrace
@BekBrace 8 ай бұрын
Somewhere
@FreePizza007
@FreePizza007 3 ай бұрын
Try pypy.
@BekBrace
@BekBrace 2 ай бұрын
.
🌐 Network Programming in Rust - Building a TCP Server
21:55
C++ vs Rust: which is faster?
21:15
fasterthanlime
Рет қаралды 402 М.
HELP!!!
00:46
Natan por Aí
Рет қаралды 66 МЛН
Кто круче, как думаешь?
00:44
МЯТНАЯ ФАНТА
Рет қаралды 4,4 МЛН
Why I Switched from Python to Rust for AI Deployment
9:57
Code In a Jiffy
Рет қаралды 30 М.
Compiled Python is FAST
12:57
Doug Mercer
Рет қаралды 116 М.
Why do developers hate Rust?
8:20
Let's Get Rusty
Рет қаралды 140 М.
The Downsides Of C++ | Prime Reacts
21:23
ThePrimeTime
Рет қаралды 143 М.
Why You Shouldn’t Build Your Next App in Rust
9:18
warpdotdev
Рет қаралды 100 М.
Rust: When C Code Isn't Enough
8:26
CodeAhead
Рет қаралды 173 М.
5 Good Python Habits
17:35
Indently
Рет қаралды 607 М.
Go vs. Rust: Performance Benchmark
6:43
Anton Putra
Рет қаралды 173 М.
how Google writes gorgeous C++
7:40
Low Level
Рет қаралды 943 М.