java custom build

T

timprepscius

I am using java's jvm inside an application to run custom scripts,
however the load time of the jvm is too slow.. I'm guessing this is
from all of the libraries being loaded etc.

Does anyone know of any existing projects that either provide a
slimmed down java jvm which only loads necessary libraries?

Or does anyone know of a micro jvm that provides JNI?

Or does anyone have any ideas on speeding up the jvm load time? (I
cannot pre-load stuff)

I need it to be under a half second, better under a quarter second.

--

Also, while I'm wishing for the moon, I'd like a jvm that is a meg or
less to download (no libraries). :)

-tim
 
E

Eric Sosman

timprepscius said:
I am using java's jvm inside an application to run custom scripts,
however the load time of the jvm is too slow.. I'm guessing this is
from all of the libraries being loaded etc.

Does anyone know of any existing projects that either provide a
slimmed down java jvm which only loads necessary libraries?

By and large, the JVM doesn't load a class until it's
referenced -- so pretty much everything that's loaded is in
fact "necessary." Try passing command-line options to the
JVM to get it to list out the classes as they're loaded; I
think you'll find that there are few if any you could do
without.
Or does anyone know of a micro jvm that provides JNI?

Or does anyone have any ideas on speeding up the jvm load time? (I
cannot pre-load stuff)

I need it to be under a half second, better under a quarter second.

If your script looks like "Start a JVM to run class C1
and exit, then start another JVM to run class C2 and exit ..."
you may be able to do better by starting just one JVM and
then calling C1.main(), C2.main(), ... instead. You wouldn't
want these classes calling System.exit() or doing similar
unfriendly things, so you should do a code review of all the
Cx and/or run each class with a SecurityManager, the way
browsers do.
 
M

Mark Space

timprepscius said:
I am using java's jvm inside an application to run custom scripts,
however the load time of the jvm is too slow.. I'm guessing this is
from all of the libraries being loaded etc.

The -verbose option will list all classes loaded, that might give you a
start. I don't know if Java Micro Edition (JME) is available for
windows, have you looked? I don't know if it does JNI either, so...

Do let us know if you find anything interesting, the results would be of
general interest.
 
T

timprepscius

Do things the way ANT does. Load the JVM and keep it loaded and run
scripts that tell it what to do.

Seehttp://mindprod.com/jgloss/ant.html

Just to clarify:
I am not loading the jvm for each script execution..

Yes I'm loading it once at application startup..
But the application startup time it too long.

--

Unfortunately startup time in this case is critical and I cannot pre-
load.

-tim
 
Z

Zig

I am not loading the jvm for each script execution..
Yes I'm loading it once at application startup..
But the application startup time it too long.

What case is "this case"? How long does your VM take to start? What & how
many libraries / packages are you linking to?

A couple notes:

* make sure when you start the VM, be sure to pass "-client" on the
command line. This will, among other things, favor startup time over
runtime performance.

* Use a JRE from www.java.com, not a JDK. The JREs are built with almost
no debugging included, making them just a smidgeon smaller and faster than
a full JDK (though the -client VM may be the only option when using a JRE).

* Try using Java 6 and Java 5 (if your app is compatible). For most users,
Java 6 is a tiny bit faster at startup, and can cut out a second or so.
For other apps, Java 6 can be A LOT slower. I can think of a couple apps
that open with a Java 5 VM in less than 10 seconds, but require well over
a minute using a Java 6 runtime. So, for some special cases, it may be
better to stick with Java 5.

* Most use cases consider 5 second VM startups to be acceptable, in favor
of optimizations in the runtime performance, rather than trying to
minimize startup time. There are plenty of optimization options, but you
should consider looking at a non Sun VM, or a solution that does not
require a VM (eg: using a native java compiler).
Or does anyone know of a micro jvm that provides JNI?

What kind of JNI are you doing? If you are loading native libraries at
startup, check and see how many libraries your native functions are
linking to.

Have you tried calling your native functions from a C app just to compare
how long your native code takes to load?

Sounds like you may need to run a profiler on your app to look for
hotspots in the startup time...

HTH,

-Zig
 
L

ldv

I am usingjava'sjvm inside an application to run custom scripts,
however the load time of the jvm is too slow.. I'm guessing this is
from all of the libraries being loaded etc.

Does anyone know of any existing projects that either provide a
slimmed downjavajvm which only loads necessary libraries?

Or does anyone know of a micro jvm that provides JNI?

Or does anyone have any ideas on speeding up the jvm load time? (I
cannot pre-load stuff)

I need it to be under a half second, better under a quarter second.

--

Also, while I'm wishing for the moon, I'd like a jvm that is a meg or
less to download (no libraries). :)

-tim

The best approximations I can think of are:

1. Open-source implementations such as GCJ (http://gcc.gnu.org/java/)
and Kaffe (http://www.kaffe.org)

2. Excelsior JET (http://www.excelsior-usa.com/jet.html) Make sure to
use its Java Runtime Slim-Down feature (http://www.excelsior-usa.com/
java-download-size.html) for size reduction and Executable Image
Optimizer for load time reduction.

Hope this helps,

LDV
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top