Precompile a script?

question

#1

Is there a way to precompile a script, so that I can execute it in batch fast?


#2

To quote the official docs,

To create an incremental precompiled module file, add __precompile__() at the top of your module file (before the module starts). This will cause it to be automatically compiled the first time it is imported. Alternatively, you can manually call Base.compilecache(modulename).


#3

What about a script, not a module?


#4

Put the main computational functions (hopefully you are using functions and not one long Matlab-style script full of globals) of the script into a module.


#5

However, it may not give you the hoped for speed-up, see e.g. https://github.com/carlobaldassi/ArgParse.jl/issues/37