This article mainly introduces the efficiency comparison between Cpy and Python. This article compares Cpy and Python running efficiency tests with a code that has been circulating for 100000000 times. if you need a friend, you can refer to beginners in the Python language, in particular, the "surprise" (that is, the one that is initially attracted by some meaningless features, and then continues to convince itself) thinks that Python does not need a C-language for statement, because they can replace the Class C for with the elegant Python.
Cpy cycle:
The code is as follows:
For (I = s; I }
Python cycle:
The code is as follows:
For I in range (num) [s: e: step]:
Recently, I wrote a code that repeats 100000000 times. Unfortunately (and as expected), Python eats up the machine memory, and let my Windows report the error of insufficient virtual memory. poor Python can only be killed by the operating system without any chance.
The Cpy cycle is not under pressure and only occupies a small amount of memory.