Python implementations speed test

Off topicProgramming → Python implementations speed test

So i decided to test the speed of different python implementations such as cpython, jython and pypy

With results that showed a great difference in speed!

But first, the code!

import random, time

def bubbleSort(alist):
    for passnum in range(len(alist)-1,0,-1):
        for i in range(passnum):
            if alist[i]>alist[i+1]:
                temp = alist[i]
                alist[i] = alist[i+1]
                alist[i+1] = temp


alist = []

for i in range(100000):
	randint = random.randint(0,100000)
	alist.append(randint)


print "Done generating random values"

start_time = time.time()

bubbleSort(alist)

print "Job took " + str(time.time() - start_time)

f = open("bubbleSort.txt", "w")
f.write(str("\n ".join(str(x) for x in alist)))
f.close()

And now the great results:

-pypy Job took 31.3761768341

-cpython Job took 703.338943005

-jython Job took 1036.19799995

-java (without infinite integers) Job took 19.997 - coded by Nemes

Isn’t the datetime import better for this?
I don’t really see why