sudden questions
2025.12.8
Why C++ is faster than Python in many ways?
Compiled vs. Interpreted
C++: Compiler translate code into machine code directly.- When Running: CPU excecute instractions directly.
Python: code -> Bytecode -> PVM (read line by line and excecute)
- When Running: CPU runs VM, VM runs Python code.
Static vs. Dynamic Typing
Memory & Object Overhead
a
intvariable: in C++4Bytes, in Python is aPyObjectstruct and takes >28Bytes.C++ has Compiler Optimization
Python library’s underlying core code is C++/C !
sudden questions