@kodekloud: Why Python Is So Slow Compared to C! A loop that adds every number from 0 to 100 million takes about 4 seconds in Python on an M4 MacBook. The same loop in C finishes in a fraction of a second, more than 100 times faster. C code is compiled into CPU instructions before the program starts, so the CPU runs the addition directly. Python first turns code into bytecode, and an interpreter reads each bytecode instruction and runs the matching CPU work. That interpreter overhead repeats on every single loop iteration. Would you trade raw speed for writing less code? Tell us in the comments. #Python #PythonProgramming #CProgramming #Programming #Coding #ComputerScience #SoftwareEngineering #Bytecode #Interpreter #DynamicTyping #LearnPython #KodeKloud #shortsfeed
im sorry that my 10 lines code ran 0,0001 sec slower than your 4K+ lines of code in c++
2026-10-27 18:51:14
244
Arctic Exploring :
Pascal is as easy as python and almost as fast as C. Also really fast to compile compared to c that take ages.
2026-10-27 15:57:46
14
Mo8a_ :
do NOT add chrome among the "fast" browsers
2026-10-28 05:10:44
100
superpower_privat :
Python is not less Code. It’s more readable and simpler Code then C. C code can be much, much shorter and do more
2026-10-28 08:57:10
16
ScottCUK :
Misheard Chrome browser for the Chromovisor and thought I was on the Python conspiracy tok channel for a min 😅
2026-10-28 13:06:18
0
Gobbriik :
python is an interpreter, C can be complex and punishing to use incorrectly. So python wraps some common C functions you can call and use simply in python. Its made to learn concepts and do larger tasks that can be slow until you hit that wall can move on to a lower level language.
2026-10-27 14:31:35
71
nemanjaradovanovic :
Incorrect. Any c++ compiler with optimization will never produce a loop for this code. it would transform the code as 1M × (1M +1) ÷ 2. So basically this 1M or 100M loop would requre 2 registers and 3 instructions. Multiplication, addition and bitshift - constant division with the number that is power of 2 is optimizes as bitshift.
And this is not the reason it is faster, the memory allocation and management, are the most important optimization, it follows with type safety (like array out of bound exceptions that introduces high), and many other things, among which is the code used as example here. Not to mention that one is compiled language and the other is interpreted. Nature does not allow interpreted languages to be optimized well, tho python can also be a compiled language that is not by default.
2026-10-28 17:49:20
1
user757 :
Python has too many middle men involved
2026-10-27 20:42:59
0
dennis masinde :
Newbies want to fight😂😅
2026-10-28 01:29:03
5
Lifting_with_Wojti :
Bro total += i is much faster than total = total + i. Just try it
2026-10-28 07:30:47
4
so.over.vic :
Does data science have to really be fast? Maybe a bit of explanation could be in order about why python is the preferred language in data science.
2026-10-28 12:41:01
0
veer 勇毅 อาวเขียว :
Sometimes CPython is even slower than Lua. With Common Lisp and Julia, programmers can write less code and still make it run fast when they want to.
2026-10-28 10:36:34
0
thomedome :
I like to think of python as a language with training wheels
2026-10-27 16:37:46
14
8legs :
do why is rust fast
2026-10-28 23:07:44
1
Hubert Samm-Duffield :
python has always sucked
2026-10-28 03:38:41
6
The Travel Geek 🇬🇧 :
Like any interpreted language, python is slow.
2026-10-28 00:04:31
10
ave :
now this is my type of vid
2026-10-28 11:55:50
2
Escanoř :
Yea that’s rough 🥲
2026-10-27 13:40:40
6
Patterson 💻 💯✅ :
Yet I love python and won’t stop using it
2026-10-28 06:31:59
3
𝚅3𝚇® :
python is good but if it is used for gaming, kernels or idk or even web ( it works but it is slow) then it will take minutes to load smth that's why C or C++ is used like directly talking tot he cpu
2026-10-27 21:18:45
1
dubs318 :
python is higher level so there's more layers of abstraction (I think)
2026-10-27 23:53:10
2
ChatGPT :
Better than python is f.e. Cobra or rattlesnake....or viper [Wzruszające]
2026-10-27 22:57:02
1
Error404Found :
thanks for explaining
2026-10-27 18:39:41
1
despinfair :
100m times
2026-10-27 14:23:31
0
To see more videos from user @kodekloud, please go to the Tikwm
homepage.