Ticket #10268: bench.sage

File bench.sage, 487 bytes (added by bgoodri, 10 years ago)
Line 
1DEGREE=2
2TERMS=5
3NUMBER=125
4
5def bench(degree,terms,alg):
6    P.<x,y,z> = PolynomialRing(QQ)
7    first = P.random_element(degree, terms)
8    second = P.random_element(degree, terms) 
9    f =  SR(first / (first + second + 1) + second / (second + first))
10    return f.simplify_rational(method=alg)
11
12# pay the one time costs
13bench(DEGREE,TERMS,"full")
14bench(DEGREE,TERMS,"normal")
15
16timeit('bench(DEGREE,TERMS,"full")', number=NUMBER)
17timeit('bench(DEGREE,TERMS,"normal")', number=NUMBER)
18
19