# demonstration of sort speeds
# Although there are (relatively rare) instances
# when a custom built search would be slightly
# faster than a built-in sort method,
# the built-in method is reliably fast and if used with care
# it does not affect seriously the time of the whole code execution.

import random
import time

N = 10000

a = list( range(0, N) )
random.shuffle( a )
t1 = time.time()
b = sorted( a )
t2 = time.time()
print( "N = ", N )
print("time", "%6.2f" % (t2-t1)  )
print()

N = 100000

a = list( range(0, N) )
random.shuffle( a )
t1 = time.time()
b = sorted( a )
t2 = time.time()
print( "N = ", N )
print("time", "%6.2f" % (t2-t1)  )
print()

N = 1000000

a = list( range(0, N) )
random.shuffle( a )
t1 = time.time()
b = sorted( a )
t2 = time.time()
print( "N = ", N )
print("time", "%6.2f" % (t2-t1)  )
print()
