anon
anon

Reputation: 42637

wasting memory to speed up jvm

On Linux & Mac, is there a way to pre-cache the JVM - either in RAM, or a state of it, so that when I start a Java program, it starts as fast as C/C++ programs?

I am willing to waste memory to make this happen.

Upvotes: 2

Views: 735

Answers (2)

PeterMmm
PeterMmm

Reputation: 24630

Would that not load the JVM binary and libs into memory so that they can be shared?

Yes, but only in the same JVM instance. So you have to load your application into this instance, as servlet container do.

The whole bootleneck of the JVM invocation is class loading, that is the reason for the Java Quickstart that Thorbjørn mentioned.

So you can put the class libs on faster media (ram disk) this will probably fasten your (first) startup. I once installed Netbeans + JSDK on a RAM disk and it starts really fast but once started it will run equal fast than loaded from disk.

Upvotes: 3

No. Unfortunately :(

On second thought, the reason why Java programs start faster on Windows these days, is because there is a process (Java Quickstart) which aggressively keeps a copy of the runtime library files in the memory cache which apparently helps immensely. I do not know if this approach has been ported to Linux.

Upvotes: 4

Related Questions