<dropping hotspot-dev from the cc list>

Did you try the same test on a regular JDK platform? This is likely due to changes in the class libraries. Such a change might be very noticeable for a "no-op" test (ie not running any application class) but may not be so significant for an actual test case.

For example, if you do "java Foo" (where there is no class Foo) in 1.5 you get a single println:

Exception in thread "main" java.lang.NoClassDefFoundError: Foo

whereas in 1.6 and JDK 7 you will get a stack dump from the exception:

Exception in thread "main" java.lang.NoClassDefFoundError: Foo
Caused by: java.lang.ClassNotFoundException: Foo
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: Foo.  Program will exit.

This might require loading many additional I/O and character set related classes. Just a hypothesis - I haven't checked it.

David Holmes
------------

Yongqiang Yang said the following on 07/31/10 15:48:
I am porting openjdk1.6 to MIPS. I have finished, but opendk1.6 is four times slower than jdk1.5 at startup. Two versions ran on the same MIPS machine . During startup, openjdk1.6 runs 1,650,000 bytecodes while jdk1.5 runs about 240,000 bytecodes.

On Sat, Jul 31, 2010 at 3:59 AM, Mandy Chung <[email protected] <mailto:[email protected]>> wrote:

    Osvaldo Doederlein wrote:

        I wonder if these numbers have some variation per platform?


    Yes, there are some platform-dependent classes and so some loaded
    classes are different on different platform.


        For me (on
        Windows; 32-bit JDKs), the results of this test (java
        -verbose:class |
        grep Loaded | wc -l) are:

        1.5.0_22: 239
        1.6.0_21: 274
        1.7.0-ea-b103: 403

    I ran the helloworld. The number of loaded classes running different jdk
    versions are fairly close.  What test case did you use?

    $ grep Loaded hw.verbose.jdk5u22 | wc -l
    303

    $ grep Loaded hw.verbose.jdk6u21 | wc -l
    323

    $ grep Loaded hw.verbose.jdk7 | wc -l
    329



        The diff from 1.5 to 1.6 is not bad, but JDK7 seems right now to
        be a
        heavy regression... FWIW for such a simple test. For one thing,
        these
        core-boot classes all come off the CDS file so their classloading
        effort is relatively very small, and the delta will certainly be
        much
        smaller for even the smallest real-world app.
    Right.  -verbose:class prints out all loaded classes regardless of
    coming from CDS archive or not. The number of loaded classes is one
    metric to the startup while class loading time + clinit time are
    other important metrics.  So these loaded classes has small impact
    to the startup time especially with CDS is enabled.

    Mandy


        A+
        Osvaldo

        2010/7/30 Mandy Chung <[email protected]
        <mailto:[email protected]>>:
            Yongqiang Yang wrote:
                hi,

                   I just type command "java" under openjdk1.6, then the
                jvm will load
308 classes, including java/launcher/LauncherHelp,
                          java/util/ResourceBundle,
                          java/util/Currency,
                          java/util/Locale,
                          java/net/URL

                      When I use jdk1.5, the jvm just load about 180
                classes, not
                including the classes above.

                      Could someone figure out something wrong?
            New features and bug fixes in a new release could lead to
            more classes get
            loaded at startup.  We have done some work to lazily load
            classes if
            appropriate (see CR 6798873: Reduce the number of classes
            loaded and class
            dependencies).

            Mandy






--
Best Wishes
Yongqiang Yang

Reply via email to