Hacker News new | ask | show | jobs
by Someone 571 days ago
> 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 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?

2 comments

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 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?).

> 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."

No, it also didn't handle circular dependencies between interface blocks. Big pain.
I never had that be a problem in practice because the interface was separate from implementation. It was exceptionally easy to sort that rare corner case out.
> You could make javac much faster just by compiling it with GraalVM

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.

GraalVM AOT can utilize profiling data from training runs to give the same speedups. It also does ML driven inference of profiles.
> 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.

But 100s of thousands of lines per minute on 1990s hardware is orders of magnitude faster than 32k lines per second 30 years later.
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.