JIT slow


It appeared to me that runFunction in JIT.cpp is slow for repeatedly
executing the same function with nontrivial arguments since the "Stub"
function in JiT.cpp:183 (LLVM 1.9) is compiled again and again.
Is there something I can do to accelerate this?


Hi G,

Have you tried using this method instead?

/// getPointerToFunctionOrStub - If the specified function has been
/// code-gen’d, return a pointer to the function. If not, compile it, or use
/// a stub to implement lazy compilation if available.
virtual void *getPointerToFunctionOrStub(Function *F);

If you can use it, this eliminates out the overhead in question, reducing it to an indirect function call.

— G