How fast does Java compile?
51–60 of 76 posts
Re: How fast does Java compile?
#52https://prog21.dadgum.com/47.html: “By the mid-1990s, Borland was citing build times of hundreds of thousands of lines of source per minute”
I know it’s a different language, but I don’t think Java is significantly harder to parse than Pascal, bytecode doesn’t have to be heavily optimised (it gets heavily morphed at runtime) and computers are a lot faster than in the 1990s.
Also, recently (2020) https://news.ycombinator.com/item?id=24735366 said: “Delphi 2 can compile large .pas files at 1.2M lines per second.”
Or am I mistaken in the idea that Java isn’t hard to parse? If so, why is it hard to parse? Annotations? Larger programs with lots of dependencies?
Re: How fast does Java compile?
#53Earlier quoted context omitted.
It is compiled to Java byte code. The JVM runs the byte code. Tokenization [1] is the process of splitting text into components called tokens. It's usually the first stage of parsing. [1]: https://en.wikipedia.org/wiki/Lexical_analysis#Tokenization
Compiled means it's a direct executable in machine code. Java ain't that. Heck, if it needs a runtime with a garbage collector built into the runtime it's especially junk.
Re: How fast does Java compile?
#54Earlier quoted context omitted.
No, that is not what compiled means. A compiler is simply a program that translates from one language to another. Hence a compiled language is one that is translated into a different language prior to execution. Java is compiled twice; once to byte code and again to machine code by the JIT compiler. That is unless you compile it directly to machine code using, say, Graal Native Image. You are welcome to your opinion…
As having a masters in computer science I respectfully disagree with you. Would you consider a program that translates C code to FORTRAN a compiler? Nope, it's a translator. A compiler compiles a language into a direct executable. Just like Microsoft Windows has executables, .exe file, there's no runtime required to run those files.
And .exe-s still need the OS, dynamic libraries, and, perhaps most importantly, the CPU (which is pretty much a VM interpreter, modern CPUs having what's essentially a custom IR, peephole optimizations, aliasing analysis, JITting, loop unrolling, PGO, caching, ...), to run.
Re: How fast does Java compile?
#55Re: How fast does Java compile?
#56Earlier quoted context omitted.
I think it means "compile it into bytecode", which can then be run by the Runtime.
That's pretty much the definition of tokenized. I know Oracle would like us to think different, but facts are facts
Re: How fast does Java compile?
#57> Compiling 32,000 lines of code per second is not bad https://prog21.dadgum.com/47.html : “By the mid-1990s, Borland was citing build times of hundreds of thousands of lines of source per minute” I know it’s a different language, but I don’t think Java is significantly harder to parse than Pascal, bytecode doesn’t have to be heavily optimised (it gets heavily morphed at runtime) and computers are a lot faster than i…
Delphi did some things that made it unusually fast to parse, like being single pass (meant you could not arrange your code as you saw fit as backreferences didn't work). Also, javac suffers from being JIT compiled so a lot of CPU is wasted each time it's invoked unless you use daemons like Gradle does.
But also, the Delphi compiler was IIRC at least partly written in assembly not Delphi itself.
You could make javac much faster just by compiling it with GraalVM but then you'd lose the ability to load plugins like annotation processors. Delphi's compiler wasn't pluggable in any way (at that time?).
Re: How fast does Java compile?
#58That's a nice writeup. Given the hot/cold difference you observe, I'd be very curious to see how builds compare when using maven daemon or gradle daemon. I am not very familiar with those myself, simply aware of them. [1] https://github.com/apache/maven-mvnd [2] https://docs.gradle.org/current/userguide/gradle_daemon.html
The benchmarks in the article do use the Gradle daemon, but not the Maven one, mostly because mvnd isn't the default. For Gradle, if you turn off the gradle daemon, it gets even slower than the numbers presented going from 4+ seconds to 10+ seconds per compile: lihaoyi mockito$ git diff diff --git a/gradle.properties b/gradle.properties index 377b887db..3336085e7 100644 --- a/gradle.properties +++ b/gradle.properties…
Re: How fast does Java compile?
#59> Compiling 32,000 lines of code per second is not bad https://prog21.dadgum.com/47.html : “By the mid-1990s, Borland was citing build times of hundreds of thousands of lines of source per minute” I know it’s a different language, but I don’t think Java is significantly harder to parse than Pascal, bytecode doesn’t have to be heavily optimised (it gets heavily morphed at runtime) and computers are a lot faster than i…
Hundreds of thousands of lines per minute isn't the same as 32,000 LOC per second . Delphi did some things that made it unusually fast to parse, like being single pass (meant you could not arrange your code as you saw fit as backreferences didn't work). Also, javac suffers from being JIT compiled so a lot of CPU is wasted each time it's invoked unless you use daemons like Gradle does. But also, the Delphi compiler wa…
Would it be faster? To start up, sure, but I'd imagine the compiler to rate quite well on the scale of how much it benefits from the dynamic runtime optimizations that are only possible with jit compilation.
Re: How fast does Java compile?
#60How fast does Golang compile? https://www.octobench.com/
How fast does Rust compi..... I better not actually.