Domanda

I have a series of functions I want to compile before running because they are somewhat slow but you only have to run them one time so there is no point in warming them up. Is there any way of doing this?

È stato utile?

Soluzione

Do you intend to precompile it?

EDIT: Thinking about this some more, precompile can not work as you ask for type unstable functions. Julia is a dynamic language and there is nothing that will prevent you from writing a function that takes a very different code path depending on the value of the argument and global variables. Precompile will only know the types of the arguments and might not be able to compile all functions called by your function, because they might not be decided yet.

The important part is anyway that you measure what you intend to measure. Microbenchmarks should exclude compilation, but if you measure your whole program you must use some judgment. I have the impression that caching of the compiled code for userland code will be implemented soonish, and then compilation time will be less important.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top