Skip to main content

Caching of VM compiled/optimized code.

3 replies [Last post]
Joined: 2007-03-30

Hello everyone,

I was wondering if anyone is planning on finally adding to the VM the ability to cache VM compiled/optimized code?

The cache could be stored somewhere configurable (size, location, if to be global or user home or a mix of both, etc...).

This would be an amazing addition, especially with the Server VM's progressive optimization. After running stuff for a while, having the server vm optimize it extensively, it would be nice that next time one starts up the program, it would already be as compiled&optimized as when the program was exited. Throughout the years, Applications running in the Sever VM peak at almost 2x the speed of client VM. Even for client VM this would be nice to only have chunky running the very first run of an install versus running instance.

I believe .NET has this, but believe me, I had this idea LONG before .NET was even announced. I think it is a pretty obvious and very important feature (for client/desktop use especially, I mean just imagine, first time through is no longer per instance, but per installation!). I really wonder why SUN has never implemented it even after decades? of having Java out.


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2007-03-30

Just adding to my question, because I didn't clearly state one point of this:

With this feature, using the server VM (almost 2x as fast as client), becomes very desirable for use on client/desktop applications (which you normally open and close often). It would pretty much make the client VM pointless -- at least to the degree that the server VM would do well as the default.

I personally run eclipse with server vm even without this feature.. then again, I never close it .

Joined: 2003-12-31

This doesn't answer your question, but regarding the server compiler - have you seen the tiered compilation news?


Joined: 2004-01-07

Well keep in mind that caching code generated by the server compiler isn't trivial at all - the code is optimized for special use-cases under special conditions with a known set of loaded classes.

What could be implemented easier would be maybe some kind of cut-down version of the client-jvm (maybe stripped away profile&dynamic stuff), and for code that needs to run faster it will use the server-compiler.

Also keep in mind that this probably won't help startup-performance of cold-starting applications, the startup-time is dominated by disk-IO which would be even worse with such a JIT cache.
It could help however with code-sharing - its simply nonsence that code generated by jits for warm (not hot!) methods is generated every time in each JVM using its own memory.
However it probably would be better to deploy a MVM based approach with a unified JIT-Code-Cache

lg Clemens