Live data from Hacker News

How fast does Java compile?

mill-build.org

41–50 of 76 posts

Re: How fast does Java compile?

#41
post #8

Earlier quoted context omitted.

Huh, so for anyone interested but did not have the time to do the comparison of the two links of OP and parent post: * java (on a cold jvm): 18.000-32.000 line per second on a single core * java (on a hot jvm): 102.000-115.000 line per second on a single core * golang: 28.000 line per second on 12 core

What I love most is how people project. I was just saying "How fast does Golang compile" because I'm interested in compilation speeds and CPU usage cross compilers (Rust, despite it's "slowness" seems to have the best CPU utilization of the compilers I've checked over the years). I've been using Java from 1996 on for two decades. A sidenote: The article is hard to read, it's not clear how much IO there is. It seems t…

All this is actually covered in the article

> These benchmarks were run ad-hoc on my laptop, an M1 10-core Macbook Pro, with OpenJDK Corretto 17.0.6. The numbers would differ on different Java versions, hardware, operating systems, and filesystems. Nevertheless, the overall trend is strong enough that you should be able to reproduce the results despite variations in the benchmarking environment.

> Again, to pick a somewhat easily-reproducible benchmark, we want a decently-sized module that’s relatively standalone within the project

> "typical" Java code should compile at ~100,000 lines/second on a single thread

> We explore the comparison between Gradle vs Mill or Maven vs Mill in more detail on their own dedicated pages

Re: How fast does Java compile?

#42
post #41

Earlier quoted context omitted.

What I love most is how people project. I was just saying "How fast does Golang compile" because I'm interested in compilation speeds and CPU usage cross compilers (Rust, despite it's "slowness" seems to have the best CPU utilization of the compilers I've checked over the years). I've been using Java from 1996 on for two decades. A sidenote: The article is hard to read, it's not clear how much IO there is. It seems t…

All this is actually covered in the article > These benchmarks were run ad-hoc on my laptop, an M1 10-core Macbook Pro, with OpenJDK Corretto 17.0.6. The numbers would differ on different Java versions, hardware, operating systems, and filesystems. Nevertheless, the overall trend is strong enough that you should be able to reproduce the results despite variations in the benchmarking environment. > Again, to pick a so…

"All this is actually covered in the article"

Then answering none of my questions.

None of your "answers" you quote answers anything to me.

> Again, to pick a somewhat easily-reproducible benchmark, we want a decently-sized module that’s relatively standalone within the project

Why not take netty src? Why is a module more easily reproduceable? We chose a decently sized module because we want a decently sized module does not explain anything.

What about IO? Why lines with comments and empty lines? Or do you even? There is no mentioning in the text as far as I can see, "lines/second" implies this, but then you say "source lines per second", does this include empty lines? I think any compiler can compile a >1.000.000.000/second of empty lines in one file that is already paged into memory.

Re: How fast does Java compile?

#43
post #40

Earlier quoted context omitted.

Outside a synthetic benchmark: * Gradle compiling 100,000 lines of Java at ~5,600 lines/s * Maven compiling 500,000 lines of Java at ~5,100 lines/s * Mill compiling at ~25,000 lines/s on both the above whole-project benchmarks Again not to put Java down but have a proper discussion about compiler speeds. I'm not interested in "your" tool is faster than "my" tool, I want to understand compilation speeds of different p…

Notably, the benchmarks I provide are all single-core. You can get more if you modularize the project and spread out the load over multiple cores, and some of the other pages linked from the OP go into more detail

Notably all the benchmarks you provide are synthetic and not achievable by developers. I more care about real benchmarks for real developers, that they can see in their daily working lifes.

Re: How fast does Java compile?

#44
post #39

Use Maven profiles: * compile only * compile/test only * compile/install jar only, skip source/javadoc packages * checkstyle only * static analysis only * code coverage only * Skip PGP (you DO check your artifact signatures, right?) The beauty of this is you can create a corporate super pom that defines all of these for you and they can be inherited by every project in your org. Finally, if you have a large multi-mod…

I don't think anyone checks their artifact signatures. I've changed signatures several times over the past few years (every time I get a new laptop I forget to copy over my keys) and haven't heard a peep from anyone using my open source libraries who actually noticed the change

We notice and costs several hours per month to handle. A malicious party can slip through, single contributor software is classified as a high risk but XZ utils were not classified as such so we would have missed the Jia Tan incident.

Re: How fast does Java compile?

#45

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…

>it doesn't lend itself to reuse, but I don't blame it either: it's not really meant to do that.

Only if you keep writing more logic into build.gradle.kts.

Writing custom Gradle plugins has been the standard and recommended way to configure your projects for years now. Aside from a few footguns (lol extensions not being resolved at configuration time and needing providers everywhere), it allows you to mostly skip configuration steps.

Re: How fast does Java compile?

#46

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

You should use your CS master skills to read the first line of the "Compiler" article in Wikipedia [1]

> In computing, a compiler is a computer program that translates computer code written in one programming language (the source language) into another language (the target language).

And maybe also the second line. JVM bytecode is an object code as referenced there.

[1] https://en.wikipedia.org/wiki/Compiler

Re: How fast does Java compile?

#47

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

Nobody calls them “translators”, that’s so silly. It’s a compiler, or transpiler (still a compiler).

Avoid using appeals to authority when discussing, it doesn’t make you look good. Even more-so when your authority is relatively mundane and you’re totally incorrect.

Re: How fast does Java compile?

#49

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

I would call this a transpiler, and it's definitely a kind of compiler. I typically use the word compiler to imply that I'm moving to a lower level representation, and a transpiler as one that does a horizonal translation.

There are expections to this general rule of thumb, Cross-compiling is a term used for a horizonal translation.

I also watched this video of a PhD project that compiles JavaScript from an input of Visual data and JavaScript. Which is probably one of the more interesting uses of compiler I've seen.

https://youtu.be/MQnVmEw6ISQ?si=NYCSuzi3IxG0md_k

Re: How fast does Java compile?

#50

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

Why would holding a MS make you an authoritative source on… anything?

Anyway, there’s no real agreement on the terms and everyone has an opinion. This is as useful as arguing “is a taco a sandwich”

Post reply on HN