Performance - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Performance Improvements in Maple 2025

 

Compact Hardware Float Representation

PopCount

Numeric Evaluation of Special Functions with Constant Arguments

Array Output for Numeric Initial Value Problems

New implementation of the projection algorithm in PolyhedralSets

New implementation of transversals in Hypergraphs

Compact Hardware Float Representation

• 

Maple 2025 uses a new compact representation of double-precision hardware floats.  The new data structure works on 64-bit machines by fitting the double into an address word when possible.  This is referred to as an "immediate"-double, similar to the concept of "immediate"-integers that has been in place in Maple for many versions.  The result is that extracting an entry from a datatype=float[8] Array does not need to allocate memory.  This can lead to a significant memory saving and performance improvements.  

• 

The following example used about 1.2s of CPU time and 159MB of memory on a benchmark machine in the previous version of Maple.  It now takes 0.16s of CPU time and uses only 11MB of memory.  This is an order of magnitude better on both the time and space measures.

n := 100:

A := Array(1..64-1, 1..n, datatype=float[8]):

tt, tr, bu := time(), time[real](), kernelopts(bytesused):

for xi from 2 to 64 - 1 do
   for xj from 2 to n do
       A[xi, xj] := add('floor(log[2](1+A[xi-1,xj-1]))', i=1..xi);
   end do;
end do:

time() - tt, time[real]() - tr, kernelopts(bytesused)-bu;

0.305,0.306,12027176

(1)

PopCount

• 

Sometimes you want to know how many bits in the binary representation of a nonnegative integer are 1. This is often called the PopCount of the integer.

• 

Maple 2025 now supports this operation with the Bits:-PopCount command.

• 

This number has a binary representation that consists of 100000 repetitions of the pattern 1, 1, 0. So it contains 200000 bits that are 1.

n := 6 * (8^100000 - 1) / (8 - 1):

Bits:-PopCount(n);

200000

(2)
• 

Doing this in earlier versions of Maple would have required something like the following. The new PopCount command is about 5000x faster.

add(Bits:-Split(n));

200000

(3)

Numeric Evaluation of Special Functions with Constant Arguments

• 

By default Maple returns a symbolic answer for exact quantities like sin(3) and sqrt(2). A new setting can be used to cause evaluation of some built-in special functions when given integer constant arguments to be evaluated to hardware floating-point results, provided Digits and UseHardwareFloats are set appropriately.   The functions that use this setting are a subset of the list given in evalhf/fcnlist. Using this can improve performance when the final result is expected to be numeric.

sin(3), sqrt(2), log(2);

sin3,2,ln2

(4)

kernelopts(evalhfconstspecfun=true):

sin(3), sqrt(2), log(2);

0.141120008059867,1.41421356237310,0.693147180559945

(5)

Array Output for Numeric Initial Value Problems

• 

The default output type for numeric IVP and DAE solution (procedurelist) has been extended for the core solvers (rkf45, ck45 and rosenbrock) to support Array-form output.

  

This allows for highly efficient solution of parameterized problems, especially when the compile option is in use, as all data required for a parameter set can be obtained in a single call.

dsn := dsolve({diff(y(t),t,t)+a*y(t)=0, y(0)=0, D(y)(0)=d}, numeric, parameters=[d,a], compile=true);

dsn:=procx_rkf45...end proc

(6)

dsn(parameters=[2,1]);

d=2.,a=1.

(7)
  

List of the columns in the Array output (indexed from 0 for time)

dsn("Array");

t,yt,ⅆⅆtyt,d,a

(8)

res21 := dsn("Array"=[10,101]);

(9)

dsn(parameters=[1,1]);

d=1.,a=1.

(10)

res11 := dsn("Array"=[10,101]);

(11)

New implementation of the projection algorithm in PolyhedralSets

• 

A key part of the process of solving a system of linear inequalities with rational coefficients is the so-called Fourier-Motzkin Elimination algorithm. This is implemented in Maple in the PolyhedralSets package's Project command. In Maple 2025, we have added a new implementation of this algorithm in C++. In most cases, this algorithm is much faster than the previous implementation - up to several hundred times faster. Consider these two examples:

with(PolyhedralSets):

ps1 := PolyhedralSet([
-84*x0 - 108*x1 + 67*x2 - 43*x3 + 106*x4 - 14*x5 - 113*x6 - 31*x7 <= 87,
-89*x0 - 22*x1 - 24*x2 + 102*x3 - 24*x4 + 123*x5 - 17*x6 - 85*x7 <= -88,
70*x0 + 81*x1 + 52*x2 + 150*x3 - 36*x4 + 97*x5 + 109*x6 - 44*x7 <= 36,
51*x0 - 114*x1 + 12*x2 + 28*x3 + 35*x4 - 29*x5 - 33*x6 + 111*x7 <= -36,
143*x0 - 1*x1 - 68*x2 + 109*x3 - 129*x4 - 147*x5 - 34*x6 + 47*x7 <= 71,
-147*x0 - 137*x1 - 134*x2 - 7*x3 - 67*x4 - 6*x5 + 64*x6 + 53*x7 <= 103,
-126*x0 + 98*x1 + 47*x2 - 72*x3 - 147*x4 + 110*x5 + 112*x6 - 73*x7 <= -24,
-137*x0 + 93*x1 - 57*x2 - 28*x3 + 51*x4 + 43*x5 + 99*x6 + 16*x7 <= 42,
80*x0 + 128*x1 + 23*x2 - 117*x3 - 35*x4 + 9*x5 - 41*x6 + 89*x7 <= 97,
-54*x0 - 135*x1 - 77*x2 - 53*x3 - 146*x4 - 8*x5 + 77*x6 - 4*x7 <= -106
]);

ps1&lcub;Coordinates&colon;x0&comma;x1&comma;x2&comma;x3&comma;x4&comma;x5&comma;x6&comma;x7Relations&colon;x05x1277x25453x35473x4274x527+77x6542x7275327&comma;x09x17+67x28443x384+53x442x56113x68431x7842928&comma;x0137x1147134x2147x32167x41472x549+64x6147+53x7147103147&comma;x022x18924x289+102x38924x489+123x58917x68985x7898889&comma;x0+93x113757x213728x3137+51x4137+43x5137+99x6137+16x713742137&comma;x0+7x19+47x21264x377x46+55x563+8x6973x7126421&comma;x038x117+4x217+28x351+35x45129x55111x617+37x7171217&comma;x0x114368x2143+109x3143129x4143147x514334x6143+47x714371143&comma;x0+81x170+26x235+15x3718x435+97x570+109x67022x7351835&comma;x0+8x15+23x280117x3807x416+9x58041x680+89x7809780

(12)

ps2 := PolyhedralSet([
107*x0 - 97*x1 + 41*x2 - 139*x3 + 124*x4 + 129*x5 + 87*x6 + 92*x7 + 118*x8 - 57*x9 <= 108,
-27*x0 + 119*x1 + 88*x2 - 8*x3 - 99*x4 - 81*x5 + 48*x6 + 55*x7 + 57*x8 - 79*x9 <= -39,
36*x0 + 104*x1 + 15*x2 + 106*x3 - 88*x4 + 39*x5 + 138*x6 - 120*x7 + 54*x8 - 75*x9 <= -2,
-2*x0 + 57*x1 - 16*x2 + 138*x3 + 86*x4 + 102*x5 + 55*x6 + 96*x7 - 114*x8 - 88*x9 <= 37,
-55*x0 - 74*x1 - 52*x2 - 15*x3 + 8*x4 - 8*x5 + 148*x6 + 96*x7 - 84*x8 + 44*x9 <= 62,
124*x0 + 36*x1 - 7*x2 - 69*x3 + 77*x4 + 33*x5 - 141*x6 - 114*x7 + 125*x8 + 27*x9 <= 24,
8*x0 + 64*x1 + 67*x2 - 25*x3 - 13*x4 - 22*x5 + 108*x6 - 108*x7 - 138*x8 + 13*x9 <= 108,
137*x0 + 86*x1 - 30*x2 - 102*x3 - 98*x4 + 17*x5 - 135*x6 - 12*x7 + 8*x8 - 95*x9 <= -77,
-126*x0 - 51*x1 - 79*x2 - 112*x3 + 119*x4 - 148*x5 + 141*x6 + 106*x7 + 108*x8 - 105*x9 <= -114,
-112*x0 - 85*x1 + 8*x2 + 42*x3 - 134*x4 - 111*x5 + 17*x6 + 21*x7 - 45*x8 + 87*x9 <= 92,
53*x0 - 17*x1 - 78*x2 - 20*x3 - 76*x4 - 110*x5 + 144*x6 - 62*x7 + 54*x8 - 82*x9 <= -38,
129*x0 - 71*x1 + 145*x2 + 96*x3 - 104*x4 - 123*x5 + 17*x6 - 67*x7 - 137*x8 + 90*x9 <= -88,
-116*x0 - 4*x1 - 14*x2 - 136*x3 - 2*x4 + 71*x5 + 82*x6 - 149*x7 - 49*x8 + 24*x9 <= -37,
135*x0 - 55*x1 + 130*x2 + 5*x3 - 73*x4 + 76*x5 + 74*x6 + 12*x7 - 82*x8 + 61*x9 <= -77,
-57*x0 - 20*x1 - 89*x2 + 15*x3 + 37*x4 + 93*x5 - 31*x6 - 32*x7 - 77*x8 + 123*x9 <= 69
]);

ps2&lcub;Coordinates&colon;x0&comma;x1&comma;x2&comma;x3&comma;x4&comma;x5&comma;x6&comma;x7&comma;x8&comma;x9Relations&colon;x085x1112+x214+3x3867x456111x5112+17x6112+3x71645x8112+87x91122328&comma;x017x14279x21268x39+17x41874x563+47x642+53x763+6x875x961921&comma;x020x15789x257+5x319+37x457+31x51931x65732x75777x857+41x9192319&comma;x0x1297x25834x329x458+71x5116+41x658149x711649x8116+6x92937116&comma;x0+119x127+88x2278x32711x433x5+16x69+55x727+19x8979x927139&comma;x0+57x128x2+69x3+43x4+51x5+55x62+48x757x844x9372&comma;x097x1107+41x2107139x3107+124x4107+129x5107+87x6107+92x7107+118x810757x9107108107&comma;x071x1129+145x2129+32x343104x412941x543+17x612967x7129137x8129+30x94388129&comma;x011x127+26x227+x32773x4135+76x5135+74x6135+4x74582x8135+61x913577135&comma;x017x15378x25320x35376x453110x553+144x65362x753+54x85382x9533853&comma; and 3 more constraints

(13)

CodeTools:-Usage(Project(ps1, [x6]));

memory used=13.16MiB, alloc change=0 bytes, cpu time=246.00ms, real time=245.00ms, gc time=0ns

&lcub;Coordinates&colon;x0&comma;x1&comma;x2&comma;x3&comma;x4&comma;x5&comma;x6&comma;x7Relations&colon;x7=0&comma;x5=0&comma;x4=0&comma;x3=0&comma;x2=0&comma;x1=0&comma;x0=0

(14)

CodeTools:-Usage(Project(ps2, [x6]));

memory used=25.31MiB, alloc change=0 bytes, cpu time=682.00ms, real time=682.00ms, gc time=0ns

&lcub;Coordinates&colon;x0&comma;x1&comma;x2&comma;x3&comma;x4&comma;x5&comma;x6&comma;x7&comma;x8&comma;x9Relations&colon;x9=0&comma;x8=0&comma;x7=0&comma;x6499997969012661301700069803005266091256090959&comma;x61186621390428537449229824261418313846290840063&comma;x5=0&comma;x4=0&comma;x3=0&comma;x2=0&comma;x1=0&comma; and 1 more constraint

(15)
• 

The calls above project the 8-dimensional polyhedral set ps1 and the 10-dimensional polyhedral set ps2 onto a one-dimensional space. On one machine, this took 24.8 and 217 seconds, respectively, in Maple 2024, but only 204 and 526 milliseconds in Maple 2025.

New implementation of transversals in Hypergraphs

• 

In Maple 2024, we introduced the Hypergraphs package, which deals with hypergraphs: a generalization of graphs where the "edges" can contain an arbitrary number of vertices. One of its features is computing is the transversal of a hypergraph: this is another hypergraph. This code was sped up significantly in 2025.

• 

To demonstrate, let us consider the so-called Lovasz hypergraphs. They are interesting in part because they are isomorphic to their own transversal.

with(Hypergraphs):

with(ExampleHypergraphs):

l5 := Lovasz(5);

l5< a hypergraph on 15 vertices with 206 hyperedges >

(16)

l6 := Lovasz(6);

l6< a hypergraph on 21 vertices with 1237 hyperedges >

(17)

l7 := Lovasz(7);

l7< a hypergraph on 28 vertices with 8660 hyperedges >

(18)

CodeTools:-Usage(Transversal(l5));

memory used=188.35KiB, alloc change=0 bytes, cpu time=8.00ms, real time=9.00ms, gc time=0ns

< a hypergraph on 15 vertices with 206 hyperedges >

(19)

CodeTools:-Usage(Transversal(l6));

memory used=0.93MiB, alloc change=0 bytes, cpu time=448.00ms, real time=448.00ms, gc time=0ns

< a hypergraph on 21 vertices with 1237 hyperedges >

(20)

CodeTools:-Usage(Transversal(l7));

memory used=6.49MiB, alloc change=0 bytes, cpu time=116.65s, real time=118.03s, gc time=0ns

< a hypergraph on 28 vertices with 8660 hyperedges >

(21)
• 

On one machine, computing the transversal of l5 took 1.19 seconds in Maple 2024 and 76 milliseconds in Maple 2025, a speedup of a factor 15. Computing the transversal of l6 took 2 minutes and 12 seconds in Maple 2024 and 447 milliseconds in Maple 2025, a speedup of roughly a factor 300. Computing the transversal of l7 in Maple 2025 takes 2 minutes and 8 seconds on this machine; computing it in Maple 2024, if it is successful at all, would likely take many days.

• 

This functionality is used in the Matroids package, which was also introduced in Maple 2024.

with(Matroids):

with(ExampleMatroids):

c4 := NCubeMatroid(4);

(22)

CodeTools:-Usage(numelems(Circuits(c4)));

memory used=41.75MiB, alloc change=0 bytes, cpu time=1.52s, real time=1.34s, gc time=322.82ms

1348

(23)

CodeTools:-Usage(numelems(Hyperplanes(c4)));

memory used=450.91KiB, alloc change=0 bytes, cpu time=38.00ms, real time=38.00ms, gc time=0ns

140

(24)
• 

On one machine, computing the circuits of the four-dimensional cube matroid took 6.97 seconds in Maple 2024 and 953 milliseconds in Maple 2025. Computing the hyperplanes (after having computed the circuits!) took 12.8 seconds in Maple 2024 and 36 milliseconds in Maple 2025.