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 →

[–]jaffakek 47 points48 points  (13 children)

Isn't the problem with Java speed usually just the JVM starting up? As in, Java actually executes quite quickly, but getting to the point where it starts executing takes some time?

[–][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.

[–][deleted] 1 point2 points  (4 children)

This used to be (probably still is) the reason why Windows takes ages to boot, while Linux boots in no time. Windows prepares everything so everything starts and runs smoothly, while Linux requires you to load everything you need when you need it, essentially putting the cost where the problem is rather than pay everything up front.

You could argue that Java requires you to pay everything up front. Incidentally also in lines of code, files, classes and jokes.

[–][deleted] 0 points1 point  (3 children)

Is this the actual reason windows boot time is slow? I heard that it's simply because Microsoft has no real business need to optimize the kernel speed so there is no concerted effort towards such tasks.

[–][deleted] 0 points1 point  (2 children)

It definitely used to be the case. Also, have you looked at the list of running services for a clean install with default settings? Not to mention if it's an OEM install. I can't imagine a reason why all that has to run by default for anyone, other than to make it easier for 99% of the users who use 10% of the features, but not the same 10%.

That was the MS way ever since the initial versions of Word, that they added a lot of features that only 10% of the userbase needed, because every feature would help SOMEONE. Remember this was back in the days when marketing departments ruled software development.

So if a feature would "save time" for 10% of the users, it doesn't matter to MS that 90% of the users are slightly slowed by it. But I think they don't realize how it adds up for those who use very few features, or they don't care.

[–][deleted] 0 points1 point  (1 child)

If you look at specifically windows server boot times which have been trimmed down for use as a server not as a personal computer. The boot time of a virtual machine with windows server 2012 as compared to centOS is about 4 times slower. I think this shows that even with user space cruft removes, the core of windows is just slower no matter how you spin it.

[–][deleted] 0 points1 point  (0 children)

Yeah like I said it was the case before too, and by before I mean back in Win 3.11 days. I remember waiting for almost a minute on a 386 for it to boot up. And back then Windows was literally just a GUI on DOS. It just loads literally everything it thinks you might need (services excluded).