| ▲ | amelius 5 hours ago | ||||||||||||||||||||||
I'm not a Java person, but I'm curious how fast it is nowadays, and also the startup time. Can it be used to write shell commands with, for example? | |||||||||||||||||||||||
| ▲ | twic 3 hours ago | parent | next [-] | ||||||||||||||||||||||
For some reason this machine is still on 21. Anyway, the overhead of the JVM itself is pretty low.For small tools it's fine:
Java startup gets slow when you use some massive framework like Spring. If you need a program to start fast, don't use one! | |||||||||||||||||||||||
| ▲ | ww520 5 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
I'm using JDK 21 (old) and the startup time is sub-second for small programs. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | OrangeDelonge 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
We use it at scale in different systems. We are moving away from it in our serverless functions due to the cold start times. Other, less latency sensitive services are OK. | |||||||||||||||||||||||
| ▲ | illusive4080 3 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
Startup time depends on whether you are using Spring heavily or not. I wouldn’t use it as a shell script replacement. Use Python to that end. | |||||||||||||||||||||||
| ▲ | azatom 5 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
Sorry if it is trivial but bc you asked shell command and if meant the "java script.java" no compile way: even that is fast, but if you run in a shell script loop thousand times, then do not forget to compile. | |||||||||||||||||||||||
| ▲ | binary132 5 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
JIT + hotspot optimization makes JVM pretty fast, but warmup time is usually the problem. However it does look like they’re addressing startup time with improvements in this release: - AOT compilation: https://openjdk.org/jeps/544 - ~100ms startup for ZGC: https://openjdk.org/jeps/545 | |||||||||||||||||||||||
| ▲ | jiggawatts 5 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
Every time I try, I keep going back to .NET, which has been optimising for faster startup time. Almost all Java benchmarks are for the "steady state" after half an hour of warm up time. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | __natty__ 5 hours ago | parent | prev [-] | ||||||||||||||||||||||
Very fast. And yes, it can be used for small apps too. With java problem now is not the performance but how verbose still it is. However, it's much better since Java 17 and each release make it even more compact and direct. Like in this release we got much better built-in support for JSON. | |||||||||||||||||||||||