Reducing JIT time


What other options do I have to reduce JIT time for large amount of code?

  • setting optimization level to none helps a lot

  • enabling FastISel doesn’t seem to help much


Hi Koffie,

I’m surprised to hear that FastISel doesn’t help - what architecture are you compiling for? Is it falling back to SelectionDAG often?

You can use an object cache if you’re not already doing so and your use-case allows for it.

If you switch to ORC you can also use lazy compilation to defer compilation of functions until they’re first executed. This can improve startup times, and reduce overall compile times if not all functions are executed.


Hi Lang,

For my information, Am I enabling it correctly?

llvm::TargetOptions TO;
TO.EnableFastISel = true;

std::string ErrStr;
engine = std::unique_ptrllvm::ExecutionEngine(llvm::EngineBuilder(std::move(sysModuleOwner))
.setOptLevel(useOptimization ? llvm::CodeGenOpt::Default : llvm::CodeGenOpt::None)

I’m targeting x64 on windows. The last time I profiled it, it spends a lot of time in the SelectionDAG. Which IR constructs would prevent FastIsel from doint its magic ? I might be able to rewrite that IR part.

The object cache is already in place for the recurring code (80% of code), but there are quite some non-recurring code that needs toe be jitted on the fly.

I will experiment with ORC also for the memory usage.