LLVM JIT speed up choices?
Asked Answered
G

2

10

It's kind of subjective, but I'm having troubles getting LLVM JIT up to speed. Jitting large bodies of code take 50 times as much time as just interpreting them even with lazy compilation turned on.

So I was wondering how can I speeding jitting up, what kind of settings I can use?

Any other recommendations?

Gift answered 2/11, 2010 at 12:0 Comment(0)
I
10

I am sorry to say that LLVM just isn't very fast as a JIT compiler, it is better as a AOT/static compiler.

I have run into the same speed issues in my llvm-lua project. What I did was to disable JIT compiling of large Lua functions. llvm-lua doesn't have lazy-compilation support turned on since LLVM requires too much C-stack space to run from Lua coroutines.

Also if you use this in your program's main() function:

llvm::cl::ParseCommandLineOptions(argc, argv, 0, true);

It will expose alot of command-line options from LLVM like '-time-passes' which will enable timing of LLVM passes, to see which parts of the JIT compiling is taking the most time.

Injustice answered 4/11, 2010 at 14:55 Comment(0)
T
0

This answer could help the ones who are using llvm orc. One way to reduce the compile time is to lower the code generation optimization level. The downside is that the runtime goes up by disabling the optimizations. If the IR is large but the code runs for just a few times, you might want to consider compiling it with less agressive optimization levels.

You can take a look at setCodeGenOptLevel() method in the JITTargetMachineBuilder.

Thorvald answered 5/12, 2023 at 18:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.