this post was submitted on 13 Jul 2023
37 points (100.0% liked)

Java

1385 readers
1 users here now

For discussing Java, the JVM, languages that run on the JVM, and other related technologies.

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] CollectiveOfCells 8 points 1 year ago (4 children)

When I worked for Amazon, someone had created a command line tool to be used in builds, but repeatedly starting up JVMs is painfully slow. I rewrote the app in C++ and it could be invoked 81 times vs one invocation of Java version.

If I need speed, I'll use C++. If I need developer productivity, I'll use Ruby.

[–] snowe 6 points 1 year ago (3 children)

Why in the world would you rewrite it when you could take an hour and get it compiling with graalvm and it would be just as fast as c++?

[–] Xgamer4 8 points 1 year ago (1 children)

Tbf he's also suggesting that Ruby is the most dev friendly language he could use, so I'm already a bit skeptical lol

[–] snowe 1 points 1 year ago

I mean, I agree with them on that. It’s very dev friendly. You definitely shouldn’t be building large scale apps in it, but it’s more readable than almost every single language out there. But rewriting a whole app in a new language instead of just using the tools available to get the best of both worlds is just a bad idea.

[–] JackbyDev 2 points 1 year ago (1 children)

I've never tried Graal. Is it easy to use? Like, is it a dropin replacement for javac or what?

[–] snowe 2 points 1 year ago

It’s pretty easy to use. If you are using a lot of reflection you might have trouble, but if you’re using a standard large framework like spring, quarkus, or micronaut you’ll be fine. Quarkus makes it dead simple honestly. We deploy all of our Kotlin lambdas on AWS using Graal. It’s faster than node and much easier to write safe code.

[–] sizeoftheuniverse 0 points 1 year ago (1 children)

And this is how people build the largest (in terms of the actual size of the binary on the disk) command line utilities in history.

[–] snowe 2 points 1 year ago

I don’t know why you would think that. GraalVM can compile tiny tiny packages, and you can easily remove features from the JVM if you don’t need them. It’s a terrible myth that JVM means massive binaries.

[–] philm 2 points 1 year ago

...If you need both, you use Rust

[–] [email protected] 1 points 1 year ago (1 children)

I'm not so sure if the JVM startup was the culprit in your situation. The Computer Language Benchmarks Game shows that even for short runtimes, the startup doesn't affect their performance numbers that much

[–] aloso 5 points 1 year ago (1 children)

That link just compares benchmarks with and without warmup, but not without startup. The JVM's startup can take upwards of 2 seconds, depending on the program.

[–] [email protected] 2 points 1 year ago

Oh, I'm dumb. Thanks for clearing this up :)

[–] [email protected] 0 points 1 year ago

You hand me till "Ruby" ROFL.