Example #1
0
    t1 = clock()
    while n:
        e.subs(x,z).subs(y,z)
        n -= 1
    t2 = clock()
    #print 'time2:',t2-t1
    return 100 / (t2-t1)

def time3(n=5):
    import swiginac
    x,y,z = map(swiginac.symbol,'xyz')
    e = ((x+2*y+3*z)**20).expand()
    t1 = clock()
    while n:
        e.subs(x==z).subs(y==z)
        n -= 1
    t2 = clock()
    print 'time3:',t2-t1
    return 100 / (t2-t1)

def timing():
    t1 = time1()
    t2 = time3()
    return t1, t2, t1/t2

print timing()
print timing()
print timing()

profile_expr('time1(5)')
Example #2
0
        n -= 1
    t2 = clock()
    return 100 / (t2-t1)


def timing():
    t1 = time1()
    t2 = time2()
    return t1, t2, t1/t2

print "without psyco"
print timing()
print timing()
print timing()

from sympycore import profile_expr

profile_expr('time2(1000)')

try:
    import psyco
except ImportError:
    psyco = None
if psyco is not None:
    psyco.full()

    print "with psyco"
    print timing()
    print timing()
    print timing()
Example #3
0
        n -= 1
    t2 = clock()
    #print 'time2:',t2-t1
    return 100 / (t2 - t1)


def time3(n=5):
    import swiginac
    x, y, z = map(swiginac.symbol, 'xyz')
    f = (x / (1 + swiginac.sin(x**(y + x**2)))**2)
    t1 = clock()
    while n:
        f = f.diff(x)
        n -= 1
    t2 = clock()
    print 'time3:', t2 - t1
    return 100 / (t2 - t1)


def timing():
    t1 = time1()
    t2 = time3()
    return t1, t2, t1 / t2


print timing()
print timing()
print timing()

profile_expr('time1(5)')
Example #4
0
    return 100 / (t2 - t1)


def time3(n=1):
    import swiginac
    x, y, z = map(swiginac.symbol, 'xyz')
    e1 = ((x + y + z)**20).expand()
    e2 = ((x + y)**19).expand()
    expr = e1 * e2
    expr = ((x + y + z)**20) * ((x + y)**19)
    t1 = clock()
    while n:
        expr.expand()
        n -= 1
    t2 = clock()
    print 'time3:', t2 - t1
    return 100 / (t2 - t1)


def timing():
    t1 = time1()
    t2 = time3()
    return t1, t2, t1 / t2


print timing()
print timing()
print timing()

profile_expr('time1(1)')
Example #5
0
    t2 = clock()
    return 100 / (t2 - t1)


def timing():
    t1 = time1()
    t2 = time2()
    return t1, t2, t1 / t2


print "without psyco"
print timing()
print timing()
print timing()

from sympycore import profile_expr

profile_expr('time2(1000)')

try:
    import psyco
except ImportError:
    psyco = None
if psyco is not None:
    psyco.full()

    print "with psyco"
    print timing()
    print timing()
    print timing()
Example #6
0
        n -= 1
    t2 = clock()
    #print 'time2:',t2-t1
    return 100 / (t2-t1)

def time3(n=1):
    import swiginac
    x,y,z = map(swiginac.symbol,'xyz')
    e1 = ((x+y+z)**20).expand()
    e2 = ((x+y)**19).expand()
    expr = e1 * e2
    expr = ((x+y+z)**20) * ((x+y)**19)
    t1 = clock()
    while n:
        expr.expand()
        n -= 1
    t2 = clock()
    print 'time3:',t2-t1
    return 100 / (t2-t1)

def timing():
    t1 = time1()
    t2 = time3()
    return t1, t2, t1/t2

print timing()
print timing()
print timing()

profile_expr('time1(1)')