Skip to content

Instantly share code, notes, and snippets.

@amalagaura
Created May 4, 2011 15:05
Show Gist options
  • Save amalagaura/955369 to your computer and use it in GitHub Desktop.
Save amalagaura/955369 to your computer and use it in GitHub Desktop.
time to sort arrays
#!/usr/bin/python
from numpy import *
import sys
from datetime import datetime
my_array = []
array_size = 640*480*3*3
a = datetime.now()
for i in range(1,array_size):
my_array.append(random.randint(0,high=sys.maxint,size=[75]))
b = datetime.now()
c = b - a
print('time to create random arrays: %d seconds %d milliseconds' % (c.seconds,(c.microseconds / 1000)))
a = datetime.now()
for arr in my_array:
arr.sort()
b = datetime.now()
c = b - a
print('time to sort arrays: %d seconds %d milliseconds' % (c.seconds,(c.microseconds / 1000)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment