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