Skip to main content

Timeline for Can code optimize code?

Current License: CC BY-SA 3.0

16 events
when toggle format what by license comment
Nov 9, 2016 at 7:24 vote accept MathLind
Nov 7, 2016 at 19:03 answer added Bill Molchan timeline score: 11
Jun 17, 2016 at 20:19 comment added masterxilo @MathLind What makes you think Mathematica code is compiled to C before being executed? From what I understand, only few data types can be Compiled. The rest is interpreted I assume. As for some automatic optimization, Google "mathematica common subexpression elimination" - I assume the Mathematica interpreter will by default not eliminate any common subexpressions because they could have side-effects, and it wants to generate correct Traces. It's probably like running your C program in Debug mode in that regard.
Mar 14, 2016 at 3:56 history edited J. M.'s missing motivation
edited tags
May 22, 2015 at 20:11 comment added MathLind @Histograms Being rather ignorant of the matter (optimization), my train of thought was the following: Since Mathematica code is compiled to some appropriate C equivalent and that code is then optimized in some way, it would be reasonable to be able to reverse that optimized C-code, back to the best representation of it in Mathematica and thereby give the user some alternative suggestions of better Mma code. I know this a gross simplification but I thought it must be possible to achieve some degree of optimization.
May 22, 2015 at 18:18 comment added Histograms There may be some cases where given some Mathematica built-ins F1, F2, F3, ... , FN possibly each with its own arguments, a rule to reduce the composition FN@* ... @*F4@*F3@*F2@*F1 to a single builtin G could be constructed- even in some appropriately general case if you're lucky. I'm pretty comfortable that I'll never need an auto-optimizer, but what would definitely be useful is a code-readability optimizer/beautifier for all those awful huge differential equations we get on here.
May 22, 2015 at 17:56 history edited Mr.Wizard
edited tags
Dec 23, 2014 at 1:06 comment added Oleksandr R. Simplify/FullSimplify also act according to their given ComplexityFunction. So, the problem is in that sense reduced to correctly expressing your idea of complexity.
Aug 24, 2014 at 6:18 comment added MathLind @mfvonh It requires a certain amount of ignorance to be able to ask a question like this. Nothing frees you from the shackles of a complex reality as a limited insight in the matter. However the question has always intrigued me and I'm hoping something good will come out of it.
Aug 23, 2014 at 22:46 history tweeted twitter.com/#!/StackMma/status/503312375551102976
Aug 23, 2014 at 19:53 comment added Michael E2 FWIW, there's Experimental`OptimizeExpression.
Aug 23, 2014 at 16:57 comment added Ariel Sepulveda I'll be thrilled to see a code that can effectively do that. I don't think it is impossible, but provided the different ways a problem can be solved and the potential set of design parameters that can make a solution better than other, I think that it would be better to create a list of community selected core problems and associated solutions with evaluation comments on pertinent design parameters.
Aug 23, 2014 at 16:51 comment added mfvonh My guess is probably not. A significant obstacle is Mathematica's symbolic/interpreted design, meaning you often cannot tell what code is doing until you evaluate it, and the same block of code might evaluate completely differently depending on the arguments you pass. I suppose you could look for certain types of optimizations, but you would have to make some strong assumptions and the scope would necessarily be quite limited.
Aug 23, 2014 at 14:21 history edited MathLind CC BY-SA 3.0
edited body
Aug 23, 2014 at 13:58 history edited MathLind CC BY-SA 3.0
added 1 character in body
Aug 23, 2014 at 13:36 history asked MathLind CC BY-SA 3.0