Good day,
Reading this thread about performance of pattern matching and functions in Mathematica I was impressed by Timo’s idea on optimizing the evaluation of expressions:
I have on occasion constructed a
Dispatch table of all the functions I
need and manually applied it to my
starting expression. This provides a
significant speed increase over normal
evaluation as none of Mathematica’s
inbuilt functions need to be parsed
against my expression.
How exactly should such a Dispatch table be constructed? In which cases would such an approach be recommended? How does it really work? Are there other methods for optimizing of the Main Loop?
To do this, first you need to be able to calculate the dependencies for your symbol(s). There’s a package to do that in a back issue of the Mathematica Journal, which is now free online. Here is the URL: http://www.mathematica-journal.com/issue/v6i1/. See the article “Power Programming: Dependency Analysis.”
Here’s a worked example:
I see no way to get the DownValues for the built-in symbols, so this is useful only to the point of reducing an expression to the point of containing only built-ins.