The line between current Python implementations and compiled languages

My understanding

C ++ is compiled into machine code and executed.

Python compiled to bytecode

Then this bytecode is executed

What does this execution step do and how is it different from Cpython and PyPy?

What is the difference in performance? Where does Python dynamic input happen in terms of performance?

Thank!

+5
source share
1 answer

C, ++ , , . , , - , , C :

int x = 10;
int y = x * 2;

, :

store 10 into memory address 200
multiply the contents of memory address 200 by 2, treating them as integers
store the result of the last instruction into memory address 300

x y, . , , , , , , . . , , , , x y . 200 , ​​ , .

Python . , . - Python, , , . , Python, Python, - Python. Python - , , Python. - , ; , Python.

, , . ++, x * 2, , CPU, , , .

Python-, x * 2, , , x , , , , , , - , , . x - , , x , Python, , , Python.

- (, PyPy, CPython, Python!); Python. , Python , Python , , Python ; x , , , , . , , Python , . , , Python , , , Python.

, . PyPy, , . , " PyPy , CPython ()?" PyPy JIT-, ++, , . () Python, , x , , - . x - . Python- x - , . , ( , , , ), PyPy JIT () x * 2 . x , . , x , JIT , , Python. , , , , . JIT , ++ , , , , ++ , ( , ).

+8

All Articles