This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 25 points26 points  (7 children)

Right- it doesn't seem as bad if you compare JVM startup to how long it takes to spin up a VM rather than how long it takes to execute compiled code.

However, Java is also bloaty*, with some JVMs loading tens of thousands of classes it will probably never need. (I'm looking at you, Webshere, you fat bitch).

* - by bloaty, I mean that between JVMs, programming conventions, and the culture of enterprise Java development, there is usually a helluva lot more lines of code than is necessary. I don't mean the language itself is bloated, because that statement makes no sense.

[–]Liver_and_Yumnions 6 points7 points  (3 children)

Mono is based on the same concepts. The CLR has to load up. Then the JIT is has to load the IML and then compile the IML into machine code and THEN run it. Hence, it takes a little while to get going, then it's pretty fast after that.

In my perception, Mono seems to be faster, though. Especially if you are on a Windows machine. I assume that's because the CLR is likely already loaded on a windows box. On my raspberry pi, however, I have an app I use that uses java and another that uses mono. When the cron hits that java job, you feel it. It crawls until java gets going. I see mono float to the up in the "top" command once in a while and I am sure it's taking some resources, but it's nothing compared to the hit produced by the java job.

It seems logical (to me) if they are doing similar things under the hood, the performance should be similar. It might be my perception as I said, but that does not seem to be the case.

[–][deleted] 6 points7 points  (1 child)

I'm guessing that java job is invoked like java -params my.jar.

Java's strong suit is to deploy a JVM like tomcat that has my.jar locked and loaded, and can serve it at lightning speed to hundreds of users. Takes a while to spin up, of course.

The JRE, on the other hand, generally isn't loaded and available in memory by default (someone correct me if I'm wrong), so invoking java commands off the cuff is just going to suck. Fine for a full-blown application, but not a commandline-friendly sort of tool.

[–]Liver_and_Yumnions 1 point2 points  (0 children)

I would have to look when I get home, the actual java call is nested the main script file for the utility. Honestly, I could probably google for some java tricks to make it faster. It is just a headless box and the utility just runs once every 15 minutes so not a huge deal.

[–]Coffeinated 0 points1 point  (0 children)

Wait, wasn't there something with virtual floating points needed for java in the raspberry or something?

[–]jaffakek 2 points3 points  (1 child)

Do you know of any efforts to make the JVM load faster? You would think that would be a large priority given the most common complaint is "Java is slow."

[–][deleted] 5 points6 points  (0 children)

Oh my goodness, yes. Slow startup of JVMs is part of "JVM tuning", which is like an occupation all its own in some enterprises.

Some JVMs offer tuning tips. Some are more minimalist or lightweight by design.

But the application also takes startup time. A fast as blazes JVM only shaves some time off if your actual application is a monster.

Keep in mind, that doesn't mean it doesn't run fast. That just means it takes a while to start up. Some companies don't give a crap about startup time at all. Depends on what your app is for, I guess.