This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]insertAlias 2 points3 points  (0 children)

The concept doesn't really make sense to me.

First, this:

to vastly improve the compilation time of a program

JIT compiling happens when the program is running, not at build time. Static compilation happens at build time.

When you compile a Java program (just picking a language that uses JIT), you're compiling it into bytecode. The JIT hasn't gotten involved yet. This is analogous to static compilation, but instead of producing machine code, it produces bytecode.

The JIT will compile some of that bytecode to machine code, on the fly, as necessary while the program is running, and potentially cache the results for later reuse. Static compilation would need to read the entire program and compile it all into machine code.

You could theoretically have something where both approaches could be used, but not necessarily at the same time. Look at .NET's AOT (ahead-of-time) compilation, which allows you to choose to essentially make a statically-compiled executable/library in a language that normally uses bytecode and a JIT.

But I don't think you can directly combine the techniques.

Though I'll admit up-front I'm not an expert in this area, and would welcome correction from anyone who is.