3 ms·
> Build a straightforward AST then convert to LLVM. How well do you think LLVM is going to optimise that code? You can't just give LLVM dumb IR directly genera
by chrisseaton 11y ago
> Build a straightforward AST then convert to LLVM.
How well do you think LLVM is going to optimise that code? You can't just give LLVM dumb IR directly generated from your AST and expect it to somehow work magic.
LLVM is low level. You need to lower your high level operations, such as method dispatch and metaprogramming, a long long way before LLVM will do anything sensible with optimising it.
For example Rubinius generates LLVM IR directly from bytecode for Ruby (so it's even a level more sophisticated than you suggest), and for every benchmark I run it's basically no faster than MRI!
For another historical example see Unladen Swallow.