Home > Article > Backend Development > Why c language runs faster than python
As we all know, python executes slower than c. Why?
Python’s traditional running execution mode: the entered source code is converted into bytecode, and then the bytecode is run in the Python virtual machine. The code is automatically compiled and then interpreted into machine code for execution on the CPU.
The c compiler directly compiles c source code into machine code. Compared with the python execution process, the process has less bytecode generation and virtual machine execution bytecode process. So it is naturally faster than python.
Python execution process is as shown below:
Additional explanation:
1. Bytecode is different from machine code and is specific to A form of expression in python.
2.PVM is the abbreviation of Python Virtual Machine, that is, python virtual machine.
For more Python related technical articles, please visit the Python Tutorial column to learn!
The above is the detailed content of Why c language runs faster than python. For more information, please follow other related articles on the PHP Chinese website!