[Date Index] [Thread Index] [Author Index]
Beware of Simplify bottlenecks in v 3.0
After installing v 3.0 on my Max 8500/120 I have done some side by side timing tests with old Notebooks comparing the speed of Mma 2.2 vs 3.0. Generally v. 3.0 is 10% to 60% slower in most cases, but ocassionally I found it to be an order of magnitude slower. I traced the difference to the frequent use of the Simplify function. This used to be a bottleneck in 2.2, and can be even more so in 3.0. The following code fragment, extracted from an old Notebook, illustrates the dramatic speed difference: fp=(a*(2*a + a*Cos[phiQ])*(2*a*Cos[phiQ]*(1 - Cos[theta]) + a*(1 - Cos[phiQ]*Cos[Pi/8]*Cos[theta] - Sin[phiQ]*Sin[Pi/8])))/ (2*2^(1/2)*(5*a^2 - (2*a + a*Cos[phiQ])*(2*a + a*Cos[Pi/8])*Cos[theta] + a*(2*a*(Cos[phiQ] + Cos[Pi/8]) - a*Sin[phiQ]*Sin[Pi/8]))^(3/2)); Print[Timing[fp=Simplify[fp]]]; Mma 2.2: 15.75 Seconds Mma 3.0: 140.517 Seconds - same result I tried to limit the operation to 15 seconds to see if 3.0 can return the same answer quicker: Print[Timing[fp=Simplify[fp,TimeConstraint->15]]]; but the option is ignored: Mma 3.0: 142.417 Seconds The purpose of this post is to warn users converting to 3.0 about such bottlenecks, and that they are uncontrollable until the TimeConstraint option works.