[Date Index] [Thread Index] [Author Index]
Re: Compiling a Module
Klamser <Klamser at t-online.de> wrote: >Can anyone tell me, why compiling a module saves no time during >execution? It all depends on whether the module compiles wholly, largely, or not at all to "Op Codes". To test this, you can check your compiled modules with the following simple utility: myFunctionIsOpCode[x_] := Apply[List,x][]// Flatten// VectorQ[#,NumberQ]& When speed is important, it is well worth tweaking your modules so that the above function returns "True". This tweaking is more of an art than a science, for me anyway. When a compiled function returns "False", I examine the compiled code (using "FullForm") for clues as to which elements the compiler is unable to parse into op-codes. Often, these are harmless. For example, Print[...] is not compiled as an opcodes, but who cares? So long as Print is used only to generate occasional status messages.