Are there any compilers built on LLVM that can compile hello world in under, say, 50 ms? That is: does LLVM itself necessarily add a big startup cost, or are compilers with long boot times adding that cost elsewhere?
-
Show this thread
-
Clang is a counterexample. Somehow I didn't think of that. So it's nothing inherent to LLVM. Maybe some kind of scaling factor that LLVM adds to complex languages, though? There certainly seems to be a correlation between LLVM as a backend and slow startup.
6 replies 0 retweets 5 likesShow this thread -
Replying to @garybernhardt
A lot of higher-level languages that rely on optimizing lots of library code like C++/Rust/Swift tend to take the "throw lots of IR at LLVM and let the optimizer sort it out" approach, which definitely stresses super-linear parts of the optimizer pipeline
1 reply 0 retweets 6 likes -
Replying to @jckarter
That makes sense. So that constant startup showing up for Rust but not C is just library size. But OCaml is presumably avoiding that penalty in another way, because it's the fastest "hello world" compiler I've seen.
3 replies 0 retweets 3 likes -
Replying to @garybernhardt
OCaml has its own tailor-made IR that's at a better fit abstraction-wise that it presumably does a lot of processing on before it lowers to asm/llvm. Now that Rust has MIR it could conceivably do similar
1 reply 0 retweets 2 likes -
-
Replying to @garybernhardt @jckarter
co-signed all of this thread, and yeah, we've done some work to be able to swap out llvm for https://github.com/cretonne/cretonne … in the future, if that makes sense for us.
1 reply 0 retweets 1 like -
Replying to @steveklabnik @garybernhardt
Part of me wonders whether there's room for an "IR construction kit" to make purpose-built IRs easier to develop. Give you a basic SSA structure, common analyses like inlining, use-def, dominance, call graph, etc., let the user provide their base instruction set and custom passes
2 replies 0 retweets 3 likes -
Sadly that won’t work too well for Rust…Rust MIR is deliberately non-SSA, so that we can borrow check it MIR and easily map back to AST for error reporting. (The theory is that this should be OK for optzns since idiomatic Rust is “mostly SSA” already.)
1 reply 0 retweets 3 likes -
Interesting, why do you need a non-SSA representation? We used SSA for Swift SIL and can do the equivalent of borrow-checking on it with source information preserved
1 reply 0 retweets 1 like
I think @nikomatsakis can elaborate further… I’m guessing we could do it, but the benefits haven’t yet been proven to outweigh the complexity + build time costs. (We’re only beginning to implement MIR optzns anyway.)
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.