ExpandAll2[exp]
is similar to ExpandAll
,
but much faster on simple structures.
Benchmark against the standard ExpandAll
exp = Sum[p[i], {i, 1, 100}] Sum[q[i], {i, 1, 1000}];
AbsoluteTiming[res1 = ExpandAll[exp];]
\{0.679579,\text{Null}\}
AbsoluteTiming[res2 = ExpandAll2[exp];]
\{0.250011,\text{Null}\}
=== res2 res1
\text{True}
ClearAll[exp, res1, res2]