Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2008

Tip: Looking for answers? Try searching our database.

java custom build

Thread view: 
timprepscius - 03 Apr 2008 16:34 GMT
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
Eric Sosman - 03 Apr 2008 16:48 GMT
> 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.

Signature

Eric Sosman
esosman@ieee-dot-org.invalid

Roedy Green - 03 Apr 2008 17:04 GMT
On Thu, 3 Apr 2008 08:34:41 -0700 (PDT), timprepscius
<timprepscius@gmail.com> wrote, quoted or indirectly quoted someone
who said :

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

Beta Jet does that.  see http://mindprod.com/jgloss/jet.html

Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Roedy Green - 03 Apr 2008 17:06 GMT
On Thu, 3 Apr 2008 08:34:41 -0700 (PDT), timprepscius
<timprepscius@gmail.com> wrote, quoted or indirectly quoted someone
who said :

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

I have two, but they require Sun to implement them.

See http://mindprod.com/project/gespenster.html
http://mindprod.com/project/suspendedanimation.html

Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Mark Space - 03 Apr 2008 17:06 GMT
> 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.
Roedy Green - 03 Apr 2008 17:07 GMT
On Thu, 3 Apr 2008 08:34:41 -0700 (PDT), timprepscius
<timprepscius@gmail.com> wrote, quoted or indirectly quoted someone
who said :

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

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

See http://mindprod.com/jgloss/ant.html
Signature


Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

timprepscius - 03 Apr 2008 17:15 GMT
On Apr 3, 12:07 pm, Roedy Green <see_webs...@mindprod.com.invalid>
wrote:
> On Thu, 3 Apr 2008 08:34:41 -0700 (PDT), timprepscius
> <timprepsc...@gmail.com> wrote, quoted or indirectly quoted someone
[quoted text clipped - 11 lines]
> Roedy Green Canadian Mind Products
> The Java Glossaryhttp://mindprod.com

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
Zig - 03 Apr 2008 21:16 GMT
> I am not loading the jvm for each script execution..
>
[quoted text clipped - 5 lines]
> Unfortunately startup time in this case is critical and I cannot pre-
> load.

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
Roedy Green - 05 Apr 2008 22:30 GMT
On Thu, 3 Apr 2008 08:34:41 -0700 (PDT), timprepscius
<timprepscius@gmail.com> wrote, quoted or indirectly quoted someone
who said :

>Or does anyone have any ideas on speeding up the jvm load time?

see http://mindprod.com/jgloss/loadtime.html
for six techniques.
Signature


Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

ldv@mail.com - 10 Apr 2008 05:21 GMT
> 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
[quoted text clipped - 16 lines]
>
> -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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.