HNHacker News
TopNewBestAskShowJobs

sgammon

1,206 karma · joined March 24, 2017

hi! i'm sam :) or sgammon on github. i am the author of Elide (elide.dev)

reach me at sam at the domain mentioned above, or github.com/sgammon

submissionscomments
sgammon··on Compiling Java into native binaries with Graal and Mill
Well, it's also not true. But aside from that, plenty of software builds in its native environment. Cross-compiling is straight up hard for many toolchains.
sgammon··on Compiling Java into native binaries with Graal and Mill
> Compile to native makes sense only for very fast startup cases.

It also makes sense to reduce container size and vulnerability surface, and to reduce warmup time to peak JIT performance.

> Still I don't see any need for native compilation.

Sure, there isn't a "need," per se, just like there is not a "need" for JIT. This is how technology evolves. Things get better. Java's startup and time-to-peak performance are now comparable to native langs.

sgammon··on Compiling Java into native binaries with Graal and Mill
You have described Micronaut
sgammon··on Compiling Java into native binaries with Graal and Mill
Sorry, I know you weren't asking me, but for this same use case, yes, I've used a GHA build matrix with each OS/arch pair.

Cosmo/APE support would fix this, and GraalVM already ships with a Musl libc implementation, so it isn't very far off.

https://github.com/oracle/graal/issues/8350

sgammon··on Compiling Java into native binaries with Graal and Mill
Builds have been slow for a long time via Native Image, but make sure you upgrade to the latest because it has gotten much faster lately. They've also worked hard on binary size.

A pure Java hello world now compiles in a few seconds on a commodity machine and weighs in at about 9mb.

Also, make sure you enable `-Ob` on newer versions of GraalVM, which significantly speeds up build times.

sgammon··on Compiling Java into native binaries with Graal and Mill
Micronaut is essentially Spring anyway, but with build-time codegen instead of classpath scanning and runtime annotation processing.

It even has a compat layer, and like Quarkus it supports GraalVM out of the box, with minimal reflection at runtime.

https://micronaut-projects.github.io/micronaut-spring/5.9.0/...

sgammon··on Compiling Java into native binaries with Graal and Mill
> Why isn't shipping the runtime with the code a more common practise?

It really shouldn't be. It bloats everything. Containers are bigger. Software is bigger. There's no reason to do this, since very few apps use the entire surface area of a runtime (Python, Node, Java, etc).

Instead, a native GraalVM binary can embed all these things, including only the portions which the application needs to run. Thus it behaves like a dynamic piece of software during development, but a static, high-performance, low-surface-area-of-vulnerability native binary in production.

> That's what I actually do for our product. The JRE is shipped with it as well as startup scripts

Please, as a user, I implore you to look into native targets. It's not as hard as it seems anymore. Some thins really do need Jlink.

> I guess the native compile thing is more for "Java on the Cloud"

Not so. GraalVM is great for embedded development. It's great for desktop development or even shared native library development.

> Java on the cloud seems like a waste of resources to me.

There is no difference now between C++ "in the cloud" and Java "in the cloud" except Java remains memory safe by default.

sgammon··on Compiling Java into native binaries with Graal and Mill
> There's actually, imho, no need for native compilation for java

Sure, that is true, but with native compilation available, Java can do even more things. There are other reasons, too: startup time, quicker time to peak performance, and better interfacing with FFM and JNI, to name a few.

> If you _need_ native, for one reason or another and it's non-negotiable, then choose a native compiled language.

You could do that, sure. But then you would need to worry about all the things that come with that. For example, memory safety -- GraalVM preserves memory safety guarantees with native binaries. Even binaries which themselves ship JIT features.

sgammon··on Compiling Java into native binaries with Graal and Mill
This is partly true. CE has the "serial GC," yes, and no access to G1 GC by default. But Oracle GraalVM (formerly "GraalVM Enterprise Edition," which no longer exists) was released under a much less restrictive license:

https://blogs.oracle.com/java/post/graalvm-free-license

So, yes, GraalVM CE is slightly nerfed (the performance difference across all EE features is like 30% maximum, at peak, in limited circumstances). You also do not need to use GraalVM CE in as many places anymore, and Oracle GraalVM with G1 is a free download. Many free projects like Pkl use the full-blown VM.

https://www.graalvm.org/latest/reference-manual/native-image...

Serial GC is still very performant. It's great for things like command line tools which don't need a low-pause long-running GC like G1.

sgammon··on Compiling Java into native binaries with Graal and Mill
Also, I don't believe this is fully true. GraalVM depends on the underlying C compiler to generate native code, so if properly configured with target triples and flags (just like any cross-compiling setup) it should work.
sgammon··on Compiling Java into native binaries with Graal and Mill
https://github.com/oracle/graal/issues/8350

Plz upvote

sgammon··on Compiling Java into native binaries with Graal and Mill
https://github.com/java-native-access/jna/pull/1608

Much of this configuration could be automatic if more attention were given to GraalVM by library authors.

sgammon··on Compiling Java into native binaries with Graal and Mill
GraalVM also has an agent for Gradle and Maven which can do this.
sgammon··on Everyone knows your location: tracking myself down through in-app ads
This comment is quoting Mitt Romney
sgammon··on OpenAI says it has evidence DeepSeek used its model to train competitor
The nyt disclosure on this reporting is about to be wild
sgammon··on Show HN: JUring – Java bindings for io_uring file I/O
This is awesome
sgammon··on A standards-first web framework
Why are you comparing yourself to Next.js, which is well-known to be slow?
sgammon··on A standards-first web framework
Why is this getting downvoted? Lol. It's a substantive, valid question. CSR is inferior to SSR in many ways: SEO, performance... so, why build it at all? I am only curious.
sgammon··on A standards-first web framework
Why are you building CSR when every other mature web framework is shooting for streaming SSR support? Why even build that at all?
sgammon··on A standards-first web framework
Then why do you have "Install Bun" in the steps to get started?
sgammon··on A standards-first web framework
Bun.x is not a standard API
sgammon··on Snyk security researcher deploys malicious NPM packages targeting cursor.com
Incredibuild is on this list (at least with regard to current leadership)
sgammon··on Oracle Will Not Voluntarily Withdraw JavaScript Trademark
Sounds like GraalVM counts and Oracle intends to argue on that basis.
sgammon··on Swc4j: SWC for Java
elide has a typescript layer for graaljs
sgammon··on I am rich and have no idea what to do
Damn, that's crazy. I'm poor and know exactly what to do.
sgammon··on Apple Photos phones home on iOS 18 and macOS 15
By removing it from the market, making enormous technical tweaks based on user feedback, and then putting it back on the market.
sgammon··on Apple Photos phones home on iOS 18 and macOS 15
> police using photos/location to figure out that a woman from Texas

How would they access that information? Under this feature, no location information for the user would be held by Apple's servers. Plus, Apple would have to divulge it somehow to law enforcement, which they don't do as a matter of course until compelled by a court. Courts have a high bar for accessing that information.

Even so, having compelled Apple, they cannot give up what they do not have.

> you've really been shilling apple

I am not "shilling" for Apple, I am commenting about a technology Apple has adopted and which I have decided to trust.

> giving multiple replies to the same comment

Sometimes I prefer to break my replies up so they are easier to consume. I don't agree with the premise that this is obnoxious and so far none of my counterparties has complained. Why are you complaining?

> what's your problem?

What's your problem?

sgammon··on Apple Photos phones home on iOS 18 and macOS 15
Ask App Not To Track was literally just the ability for the user to choose for themselves whether tracking is allowed. That’s a user agency improvement.
sgammon··on Show HN: Watch 3 AIs compete in real-time stock trading
> Watch AI bots trade

> BOUGHT TLRY

sgammon··on Apple Photos phones home on iOS 18 and macOS 15
> Not impressed.

So Apple kneecaps Meta's cross-app advertising, something that literally makes them no direct revenue to implement, and protects users (it famously reduced Facebook cross-app analytics traffic to a significant degree), and you think this is business as usual?

Then you should reconsider my comment at the top of this thread, because it is 100% speaking to this exact phenomenon.

← PreviousPage 5 of 26Next →