Cobra vs Python - speed
Posted: Wed Nov 17, 2010 11:52 am
I did a little performance comparison between Cobra and Python. I like the results, so I want to share it with the community.
The test consists of two scripts (Python and Cobra):
Python
Cobra
Results
Python: 2.5s
Cobra: 0.0056s
Conclusion
2.5 / 0.0056 = 446.42
This means 1 Cobra can beat 446 Pythons
Maybe this only seems cool to me because I have very little experience with compiled languages.
Benjamin
The test consists of two scripts (Python and Cobra):
Python
- Code: Select all
from time import clock
start = clock()
for i in range(200):
for j in range(200):
for y in range(200):
x = i+j+y
duration = clock() - start
input('duration: %s\n\nDone...'%duration)
Cobra
class Speedtest
def main
sw = System.Diagnostics.Stopwatch()
sw.start
for i in 200
for j in 200
for y in 200
x = i+j+y
sw.stop
print 'duration: [sw.elapsed] ms'
Results
Python: 2.5s
Cobra: 0.0056s
Conclusion
2.5 / 0.0056 = 446.42
This means 1 Cobra can beat 446 Pythons
Maybe this only seems cool to me because I have very little experience with compiled languages.
Benjamin