Live data from Hacker News

How fast does Java compile?

mill-build.org

61–70 of 76 posts

Re: How fast does Java compile?

#61
post #52

> 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…

> Hundreds of thousands of lines per minute isn't the same as 32,000 LOC per second.

Right, this is an example of the Java speed being terrible because Borland was almost as good thirty years ago. 32,000 lines per second is 100,000 lines per three seconds, 2 million lines per minute. Compare the statistic that wasn't thirty years old:

> “Delphi 2 can compile large .pas files at 1.2M lines per second.

Re: How fast does Java compile?

#62

Earlier 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

> That's pretty much the definition of tokenized

Oh boy. It’s rare to see such confidence mixed with such nonsense.

Re: How fast does Java compile?

#63

Long classpaths with unnecessary direct dependencies (i.e. not runtime) cause surprising slowdowns due to lookup performance.

I forgot to mention, I wrote about it https://fzakaria.com/2024/11/08/jvm-boot-optimization-via-ja...

I'm kind of intrigued by Mill but I've fallen into the same trap I've observed in others. I'm over indexed in mental capacity in having wasted learning Bazel and it's equivalent systems.

The lift to another system has to be enough to surpass that loss.

Re: How fast does Java compile?

#64
post #52

> 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…

> meant you could not arrange your code as you saw fit as backreferences didn't work

The actual consequence is that you had to declare things at the beginning of the block. It handled forward declarations just fine. This had minimal impacts on actually "arranging your code."

Re: How fast does Java compile?

#65
post #52

> 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…

But 100s of thousands of lines per minute on 1990s hardware is orders of magnitude faster than 32k lines per second 30 years later.

Re: How fast does Java compile?

#66

Interesting read. Just one remark to the "Keeping the JVM Hot" Benchmark: Running the same Compilation Task on exactly the same input over and over again gives the Just in Time compiler of your Java runtime engine the chance to optimize for this specific task. This somehow spoils the idea of this benchmark because in a real world situation the source code changes between each compilation process.

Yeah but only some lines will change , it will probably still be useful. That’s why there is gradle daemon etc

Re: How fast does Java compile?

#68
post #52

> 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…

The very next sentence is

> But it is nowhere near how fast the Java compiler can run.

And then it explains why that initial build was compiling only 32k lines per second.

Re: How fast does Java compile?

#69

Earlier quoted context omitted.

Alas, I'm stuck with Gradle. And not a simple example of the species, either.

I think thats the major issue I have with Gradle in large orgs: it doesn't lend itself to reuse, but I don't blame it either: it's not really meant to do that. I'm dating myself, but 20 years ago, we had Ant. It was very much a blunt hammer like CMake. Maven came along and was like "how about we choose a definitive way to organize projects, make that repeatable". You lose flexibility but gain speed/reuse. I see Gradl…

> You lose flexibility but gain speed/reuse.

Its actually: You lose major flexibility AND all your speed but gain reuse.

Re: How fast does Java compile?

#70

Earlier 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

You are thinking of the typical design of a BASIC system in the 80's. Keywords were stored as "tokens" (numbers) but expressions were usually stored as space-stripped strings. There would be an edit-time syntax check (combined with the tokenization) to check if the expressions were syntactical and only in places where they were allowed). Some designs did use tokens for the expressions too.

There was almost no syntax involved and essentially zero compilation work.

Java compilers do a lot more than that. They actually compile to a real (abstract) machine and they do real compiler things (proper parsing, maintenance of namespaces, type checks). They usually don't do any optimization because that will happen at run-time anyway -- but that doesn't make them "not compilers".

Post reply on HN