Comment #40 on issue 2607 by [email protected]: as_numer_denom() is too slow
http://code.google.com/p/sympy/issues/detail?id=2607

OK, here's the current results of my work:

I have two modifications in preprocessing: one where just the numerical lcm is computed and another where that and the terms_gcd is computed. The timings below show the results of running the simple (numerical) lcm, the terms_gcd, together on the expression, and as_numer_denom4b on the expression that is indicated in the input at the start of each section.


from timeit import timeit as T
T('Add(*[Dummy()/i for i in xrange(1,200)]).as_numer_denom()','from sympy im
port Dummy, Add',number=1)
simple gcd 0.23378257276386835
terms gcd  2.8587177194605022
together   0.15083904281651428
routine 4b 0.18679750799259232

T('Add(*[i/Dummy() for i in xrange(1,200)]).as_numer_denom()','from sympy im
port Dummy, Add',number=1)
simple gcd 0.414839153554162
terms gcd  10.153263992420623
together   6.608234780237012
routine 4b 5.911767208939398

T('Add(*[Dummy() for i in xrange(1,200)]).as_numer_denom()','from sympy impo
rt Dummy, Add',number=1)
simple gcd 0.009202504311595305
terms gcd  0.008690342651018312
together   0.09114067988821262
routine 4b 0.06620112419227553

T('Add(*[1/Dummy() for i in xrange(1,200)]).as_numer_denom()','from sympy im
port Dummy, Add',number=1)
simple gcd 0.3079275857755306
terms gcd  10.042154647187779
together   6.558301838040023
routine 4b 2.9675682215737424


--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to