Why is CoefficientRules so slow in this example (v10.2 on OS X 10.11.4)?
expr = Sum[x^i, {i, 1, 15}]^30;
CoefficientRules[expr/(expr + expr^2), y]; // AbsoluteTiming
MonomialList[expr/(expr + expr^2), y]; // AbsoluteTiming
CoefficientRules[Expand@(expr/(expr + expr^2)), y]; // AbsoluteTiming
CoefficientList[expr/(expr + expr^2), y]; // AbsoluteTiming
(* Out:
{1.83157, Null}
{1.42334, Null}
{8.48815, Null}
{0.000063, Null}
*)
Note that it does not seem to be related to the similar issue that Coefficient does not always expand the expression. Also note that the expression to which CoefficientRules[#, y] & is applied does not actually contain y.
Is there any clever way of efficiently achieving the result of CoefficientRules or MonomialList without parsing the output of CoefficientList (as I want to generally be able to use this efficiently in the multivariate case)?



expr/(expr + expr^2)does not result in a polynomial, which is what's expected for the first argument of those functions. – ciao Apr 27 '16 at 23:12CoefficientRules[Expand@#,y]&(but only 1 second to do the first two). Timings on v9 are similar to yours. On v10.3, it takes 15 seconds to do first three (regression?) on 10.4 it takes 17 seconds on the first three (further regression). – QuantumDot Apr 28 '16 at 07:54Expandis taking the same time as the other two. – Peter Kravchuk Apr 28 '16 at 16:54AbsoluteTiming, rather thanTiming. The latter may be confusing sometimes and it is hard to compare different operating systems / CPU architectures (see Details on AbsoluteTiming, "On certain computer systems with multiple CPUs, the Wolfram Language kernel may sometimes spawn additional threads on different CPUs. On some operating systems, Timing may ignore these additional threads. On other operating systems, it may give the total time spent in all threads, which may exceed the result from AbsoluteTiming."). – MarcoB Apr 28 '16 at 17:16AbsoluteTiming, it takes roughly 9s to execute each of the first three lines, and 38ms for the last. – MarcoB Apr 28 '16 at 17:18yasxin my quick glance... – ciao Apr 28 '16 at 22:34