Live data from Hacker News

JEP 544: Ahead-of-Time Code Compilation

openjdk.org

61–70 of 76 posts

Re: JEP 544: Ahead-of-Time Code Compilation

#61
post #58
post #39

Earlier quoted context omitted.

Depends on how much effort, like on C and C++, you are willing to put into PGO metadata for the compiler and linker.

Even if you can gather that PGO metadata a running application won't be able to adapt to changes in that data.

It works well enough for systems software written in C and C++, where Java still remains a niche option, even when it could deliver.

Re: JEP 544: Ahead-of-Time Code Compilation

#62
post #45
post #5

Earlier quoted context omitted.

IBM's J9 had AOT for a long time too. I wonder how JEP 544 compares.

IMHO the most interesting feature of OpenJ9 is the compile server. One node decides to optimize, sends over the traces, and the compile server sends optimized native code to all nodes. Or a new node joins and could be brought up to speed within a very short time.

Azul also has a similar feature, as added info.

Re: JEP 544: Ahead-of-Time Code Compilation

#63
post #4

Excelsior JET did that 25 years ago: https://en.wikipedia.org/wiki/Excelsior_JET It's a shame that Sun/Oracle never partnered with them to bring native apps. This could have saved Java on the desktop.

The JRockit JVM had it already 20 years ago, and the company was even bought by Oracle shortly afterwards.

Some of the features have been added to JDK or GraalVM.

Re: JEP 544: Ahead-of-Time Code Compilation

#64

A little late, isn't it? .NET has had this for over 20 years (pre-compile).

Java as well, since 2000, one year before .NET public announcement in 2001.

Java is an ecosystem like C and C++, there were always multiple implementations to choose from, some of them required money for the goodies like AOT.

Re: JEP 544: Ahead-of-Time Code Compilation

#65
post #30
post #23

Earlier quoted context omitted.

> so long as you can live without third-party libraries that don't support AOT. Yes, and that’s a significant limitation in the Java library and framework ecosystem.

But the possibility of AOT compilation is what drives libraries to support it. That's why .NET libraries are adapting over time to support AOT.

EF Core and F# still don't fully work, neither do the GUI frameworks, with exception of the buggy WinUI, mostly because it is all COM/WinRT underneath.

Re: JEP 544: Ahead-of-Time Code Compilation

#66
post #54

Earlier quoted context omitted.

What would be in your ideal tool? I have a company that makes Conveyor, which is very good at distributing JVM apps. It's primarily meant for desktop apps and replaces jpackage with something that can cross-build, make apps self-updating, auto-minimize the bundled JDK and so on. Adapting it for servers is something I think about sometimes, and in fact it does already support that to some extent, but it produces debs…

My ideal tool would be less tooling, which I know is not a great answer. But what I mean by this is that I can probably cobble together a build pipeline that handles most of this stuff if I spend enough time working with Gradle. And the reality of Java's popularity in the enterprise means that its build tools generally orient around builds that can be crazy and bespoke and so immense flexibility is usually needed. I…

Yeah, I agree the situation for CLI apps specifically could be a lot better, especially as the complexity keeps going up.

Native Image does produce single binaries in many cases, but what we need here is a much better tool in general. Actually I'm working on one right now, although it's not JVM specific. Want to take a look?

Re: JEP 544: Ahead-of-Time Code Compilation

#67
post #65
post #30

Earlier quoted context omitted.

But the possibility of AOT compilation is what drives libraries to support it. That's why .NET libraries are adapting over time to support AOT.

EF Core and F# still don't fully work, neither do the GUI frameworks, with exception of the buggy WinUI, mostly because it is all COM/WinRT underneath.

EF Core heavily relies on reflection so that's not really a surprise. F# not working surprised me but apparently the main thing is its `printf` depends on reflection.

By "the GUI frameworks" I assume you mean Microsoft's GUI frameworks. They're all basically abandoned or just bad. Use Avalonia! It's better, cross-platform, and supports AOT!

Re: JEP 544: Ahead-of-Time Code Compilation

#68
post #67
post #65

Earlier quoted context omitted.

EF Core and F# still don't fully work, neither do the GUI frameworks, with exception of the buggy WinUI, mostly because it is all COM/WinRT underneath.

EF Core heavily relies on reflection so that's not really a surprise. F# not working surprised me but apparently the main thing is its `printf` depends on reflection. By "the GUI frameworks" I assume you mean Microsoft's GUI frameworks. They're all basically abandoned or just bad. Use Avalonia! It's better, cross-platform, and supports AOT!

Well, they had enough time to refactor EF Core to use code generators.

F# is improving on .NET 11, but still not fully there, as contrary to the rest of .NET, it is mostly community driven.

Most Microsoft shops only consider Microsoft GUI frameworks, regardless of the great work done by Avalonia, and Uno as well.

As for being bad, they surely are much better than most competitors from other ecosystems, unless we're adding Delphi, C++ Builder, Qt into the picture.

I had projects with Java on the server and Microsoft GUIs on the desktop, for example. Swing and JavaFX are also quite good, however require additional programming for what Forms and WPF do out of the box, unless one is willing to pay for something like JGoodies.

Re: JEP 544: Ahead-of-Time Code Compilation

#69
post #57

Earlier quoted context omitted.

Are you describing jpackage? I'm not sure how you would make it less bespoke, given you are essentially creating a Java runtime for your program. Maybe the Java folks could tree-shake the runtime for you so you wouldn't have to care about their weird module system, but it's not the worst thing to learn.

Jpackage or jlink should be extended to support creating AppImages.

It already supports that, try running "jpackage --help".

Re: JEP 544: Ahead-of-Time Code Compilation

#70
post #61
post #58

Earlier quoted context omitted.

Even if you can gather that PGO metadata a running application won't be able to adapt to changes in that data.

It works well enough for systems software written in C and C++, where Java still remains a niche option, even when it could deliver.

Java has many dynamic features where runtime optimization is required to remove the overhead. Virtual method calls are opt-out instead of opt-in, and there is an open world assumption. The possibility of doing stack allocation of objects depends on the call hierarchy (in the future it will get a bit easier with value objects). Also, C/C++ are not managed languages, therefore the effects of bad optimization don't hurt as much.
Post reply on HN