1. Hakan Ardo
  2. hakanardo

Source

hakanardo / sqrt / time_sqrt2.py

import sys, time
from sqrt import sqrt, sqrt2, Fix16

try:
    import pypyjit
    pypyjit.set_param(trace_limit=20000)
except ImportError:
    pass

type1 = eval(sys.argv[1])
type2 = eval(sys.argv[2])
sqrt = sqrt2
    

sys.setcheckinterval(1000000)
#sys.setcheckinterval(2)
if type1:
    sqrt(type1(123456))
if type2:
    a = time.time()
    for i in range(10):
        sqrt(type2(123456), 10000000)
    b = time.time()
    #print sys.argv[1:], b - a
    print '    <td>', '%.2f' % (b-a), 's</td>'