# Has compilation of big programs become excessively sluggish in v 10.4?

Bug introduced in 10.4 and fixed in 11.0

After updating to 10.4, many of my heavily numerical functions defined by Compile takes a huge amount of time to compile to Wolfram Virtual Machine.

As an example, after running the definitions in this question to compute the dilogarithm function, observe how long it takes to compile the following function in Mathematica 10.4, and in previous versions (10.3 and earlier):

f = Compile[{{x, _Real}, {a, _Real}, {b, _Real}, {c, _Real}},
reLi2[((x - b^2 + a^2) (a^2 - c^2))/(x a^2 - (b^2 - a^2) (a^2 - c^2))] -
reLi2[-(((b^2 - a^2) (a^2 - c^2))/(x a^2 - (b^2 - a^2) (a^2 - c^2)))] +
reLi2[-(((b^2 - a^2) a^2)/(x a^2 - (b^2 - a^2) (a^2 - c^2)))] -
reLi2[-((a^2 a^2)/(x a^2 - (b^2 - a^2) (a^2 - c^2)))] +
reLi2[((x - a^2 + c^2) (c^2 - b^2))/(x c^2 - (a^2 - c^2) (c^2 - b^2))] -
reLi2[-(((a^2 - c^2) (c^2 - b^2))/(x c^2 - (a^2 - c^2) (c^2 - b^2)))] +
reLi2[-(((a^2 - c^2) c^2)/(x c^2 - (a^2 - c^2) (c^2 - b^2)))] -
reLi2[-((c^2 c^2)/(x c^2 - (a^2 - c^2) (c^2 - b^2)))] -
reLi2[((x - (a^2)^2 + (c^2)^2) ((c^2)^2 - (b^2)^2))/(x (c^2)^2 - ((a^2)^2 - (c^2)^2) ((c^2)^2 - (b^2)^2))] -
reLi2[-((((a^2)^2 - (c^2)^2) ((c^2)^2 - (b^2)^2))/(x (c^2)^2 - ((a^2)^2 - (c^2)^2) ((c^2)^2 - (b^2)^2)))] +
reLi2[-((((a^2)^2 - (c^2)^2) (c^2)^2)/(x (c^2)^2 - ((a^2)^2 - (c^2)^2) ((c^2)^2 - (b^2)^2)))] -
reLi2[-(((c^2)^2 (c^2)^2)/(x (c^2)^2 - ((a^2)^2 - (c^2)^2) ((c^2)^2 - (b^2)^2)))],
CompilationOptions -> {"InlineExternalDefinitions" -> True}]


My MacOS X 10.10$$^†$$ computer takes 3 seconds on Mathematica 10.4, and nearly instantaneous on Mathematica 9.0.1. The actual functions used in my code contains over 100 instances of reLi2 in the body of Compile, and it takes over a minute just to compile on version 10.4.

Does anyone else observe this problem? Are there any workarounds? Setting option "ExpressionOptimization"->False helps just a tad, but not nearly enough.

$$^†$$ update: I also observe the problem in Linux.

• Something spooky: when you put semicolon ; at end of the command to "suppress the output" compilation goes quickly like in earlier versions. This semicolon trick does not work if this code is called from a package file. – QuantumDot Mar 17 '16 at 18:58
• It looks like it's the typesetting that takes all the time. Try using SetSystemOptions["TypesetOptions" -> {"IconicElidedForms" -> False}] – Simon Woods Mar 17 '16 at 21:54
• @SimonWoods Thanks, this seems to solve some of the cases, but not all. In particular, if the body of the Compile is constructed using With for code injection, it still performs much slower than earlier versions. – QuantumDot Mar 18 '16 at 8:18
• This problem has been reported [CASE:3559742]. – QuantumDot Mar 18 '16 at 21:01
• @QuantumDot I have forwarded your contact details to our prerelease program coordinators and I hope they will be in touch soon with more information. – ilian Jun 4 '16 at 15:52

• I have reported this problem [CASE:3559742], and have notified technical support that the problem is urgent because compilation time in my package is now over 90 seconds with v10.4, when it was well under 1 second in v10.3 and earlier. While evaluation speeds of Compile called directly within the notebook can be improved with a semicolon or by modifying SystemOptions, nothing seems to be possible to improve compilation times from within a package file. – QuantumDot Mar 18 '16 at 20:59
As of version 11, the bug has been fixed. Compile now performs like it did in version 10.3 and earlier.