Created
May 4, 2011 15:05
-
-
Save amalagaura/955369 to your computer and use it in GitHub Desktop.
time to sort arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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