 Efficiency Improvements in Maple 12 - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : System : Information : Updates : Maple 12 : updates/Maple12/efficiency

Efficiency Improvements in Maple 12

 Maple 12 includes numerous efficiency improvements.  Some highlights where dramatic speed-ups were achieved are described below.

zip

 Several enhancements were made to zip.
 • Direct hardware-float callbacks are recognized for certain routines.  These can bypass much of the overhead of ordinary interpreted function evaluation resulting in speed similar to that of compiled code. The following now takes 0.084 seconds in Maple 12 compared to 3.900 seconds on the same machine in Maple 11.
 > N := 1000:
 > A := Matrix(1..N,1..N,datatype=float):
 > B := Matrix(1..N,1..N,datatype=float):
 > time(zip(+,A,B));
 ${0.014}$ (1)
 • Special case detection for some built-in non-hardware float operations. For example, the following now takes 0.104s compared to 3.532s before.
 > N := 1000:
 > A := Matrix(1..N,1..N):
 > B := Matrix(1..N,1..N):
 > time(zip(+,A,B));
 ${0.014}$ (2)
 • Automatic procedure inlining is applied when possible.  Most arrow-operator functions bypass normal function evaluation overhead resulting in better speed.  The following now takes 1.104s compared to 4.248s before.
 > N := 1000:
 > A := Matrix(1..N,1..N):
 > B := Matrix(1..N,1..N):
 > time(zip((x,y)->x+y+1,A,B));
 ${0.089}$ (3)

Block Copy

 • With the introduction of round bracket array indexing, certain block-copy operations can be done much more efficiently as no intermediate object needs to be created.  For example the second timing below using round brackets for indexing into A and B is much faster than the first timing, which uses square brackets.  The result of a square bracket index assignment is always the assigned value so an intermediate object needs to be computed.  The result of a round bracket index assignment is always the whole array, so, if the right side is a large block subselection, the intermediate copy can be bypassed in most cases resulting in memory savings.
 > N := 4000:
 > A := LinearAlgebra:-RandomMatrix(N,N):
 > B := Matrix(N,N):
 > t := time():
 > B[1001..4000,1001..4000]:=A[1..3000,1..3000]:
 > time()-t;
 ${0.265}$ (4)
 > t := time():
 > B(1001..4000,1001..4000):=A(1..3000,1..3000):
 > time()-t;
 ${0.016}$ (5)

Improvements to solve

 • The solve command takes further advantage of the FGb library, the world's most efficient Groebner bases engine.  It also uses a new, faster sparse exact linear system solver for systems with rational coefficients.
 • Here is an example of a small dimension 1 system for which the solve command in Maple 11 was unable to find a solution.  A solution could be found using FGb by calling the Groebner[Solve] command. Now in Maple 12, solve uses FGb and finds the 22 solutions in about 30 seconds.
 > symmetric5:={d^5-e^5,c^5-d^5,b^5-c^5,a^5-b^5,a^4*b+b^4*c+c^4*d+d^4*e+a*e^4}:
 > time(solve(symmetric5,{a,b,c,d,e}));
 ${12.446}$ (6)
 In Maple 10, before the FGb library was used by the Groebner package, solving this system would have taken about twice as long on the same machine.

Expansion of Symbolic Polynomials

 • Expansion of large polynomials via the expand command has been improved. The following is a subset of a larger example.  The original example used to take over 1400s to compute and now finishes in under 200s on the same machine.  The example below has about a 3 times speed-up compared to Maple 11.
 > ee := (-12*c^2*x^2*f+18*c^2*x^2*b+18*c*x^2*g*f+18*x^2*b*a^2+18*c^2*x^2*a-12*x^2*b^2*f-12*c^2*x^2*g+18*x^2*b^2*a+18*c*x^2*b^2-4+6*g-12*x*a*g-6*x^3*b*a^2-27*x^2*g*f-12*x*a*f+63*x*g*f-12*c*x*f+12*x*a*g^2-6*c*x^2*a*f-6*c*x^2*b*f-6*c*x^2*b*g+6*c*x*g*f-6*c*x^2*a*g-6*x^2*b*a*f+6*x*b*g*f-6*x^2*b*a*g+6*x*a*g*f-18*x*b*a*f-18*x*b*a*g-18*c*x*a*f-18*c*x*a*g-18*c*x*b*f+54*c*b*a*x-18*c*x*b*g+4*x^3*b^3+4*x^3*a^3+4*c^3*x^3+6*c^2*x^2+6*x^2*b^2+18*x^2*f-54*c*b*a*x^2+9*x+6*f+9*x*b*a+24*c*b*a*x^3+18*x^2*b*g*f+18*x^2*a*g*f+18*c*x^2*a^2-12*x^2*b^2*g-12*x^2*a^2*f-12*x^2*a^2*g)^6:
 > time(expand(ee));
 ${0.149}$ (7)

 See Also