←back to thread

257 points pmig | 1 comments | | HN request time: 0s | source
Show context
pseudoramble ◴[] No.43096211[source]
I’ve been out of the Java scene for a really long time, but will be coming back to it soon. I’m curious - these performance issues described here, are they inherit to how Java itself? Is it baggage from Spring/Boot? Are there ways to get more bang for the buck with some careful choices in a system like this?

The closest I’ve done to Java recently is C#, which I think may have similar challenges, but overall didn’t seem quite as bad if you avoided lots of framework extras. It also wasn’t something I was digging into deeply though, so perhaps I’m mistaken.

replies(6): >>43096295 #>>43096314 #>>43096318 #>>43096420 #>>43096427 #>>43100389 #
gred ◴[] No.43096318[source]
My experience with very simple Jersey web apps is ~1.5 seconds to start up. Much less than his reported ~8 seconds with Spring Boot, but still not in the 100 ms range he reports with Go. I assume one second or so is about as low as you can go with a mainstream Java framework without AOT, though I'd be happy to be corrected.
replies(3): >>43096340 #>>43096666 #>>43100143 #
maccard ◴[] No.43096340[source]
I worked on an app in kotlin a while back, and am currently working in a dotnet app. We can run our entire unit test suite faster than the JVM started up on that project.

Also, 8 seconds is quick in my experience for Java - I’ve seen more like 15-30

replies(1): >>43097789 #
winrid ◴[] No.43097789[source]
The JVM starts in milliseconds

Probably you're loading many thousands of classes...

replies(1): >>43099782 #
mrkeen ◴[] No.43099782[source]
It certainly tells me it does. i can hit 'run unit test', sit back in my chair and zone out for 5 seconds, then come back and read that the test took 22ms.
replies(3): >>43099847 #>>43099922 #>>43100197 #
winrid ◴[] No.43099922[source]
haha well your test did take 22ms, but starting the JVM and loading all the classes and all your dependency injection stuff probably took 5s. You can test it yourself with a tiny hello world, it's pretty fast to start.
replies(1): >>43100270 #
maccard ◴[] No.43100270[source]
But that's our point - you're saying java is fast (and it is ripping fast once it gets going) and the startup is fast, unless it's not.
replies(1): >>43100963 #
winrid ◴[] No.43100963[source]
Well no, startup is fast, period. You're probably just giving the class loader a ton of work on startup? I would start with checking that I think.

It could also be when he's hitting "run test" it's actually "compile and run"...

replies(2): >>43101254 #>>43103705 #
1. mrkeen ◴[] No.43103705[source]
Well I could switch to a programming language that isn't so slowed down by ahead-of-time compilation. Maybe a JIT language?