Measuring Class Load Time Using OptimizeIt

Discussion in 'Java' started by John Raggio, Mar 3, 2004.

  1. John Raggio

    John Raggio Guest

    Is it possible to easily measure class load time ( and any dependent
    classes that are subsequently loaded) using OptimizeIt? I am trying
    to figure out how big a hit we are taking on app load for class
    loading. I'm not even sure if this makes sense, but I want to get a
    feel for the CPU time overhead caused by loading classes.

    Is there a good resource for learning how to best use OptimizeIt? I
    read and understand the user manual, but it doesn't really give me a
    good handle on how to use the tool effectively.

    Thanks,
    John
    John Raggio, Mar 3, 2004
    #1
    1. Advertising

  2. John Raggio

    nos Guest

    You could run a test.
    But I suppose you think it is easier to ask someone else to do it for ya.

    "John Raggio" <> wrote in message
    news:...
    > Is it possible to easily measure class load time ( and any dependent
    > classes that are subsequently loaded) using OptimizeIt? I am trying
    > to figure out how big a hit we are taking on app load for class
    > loading. I'm not even sure if this makes sense, but I want to get a
    > feel for the CPU time overhead caused by loading classes.
    >
    > Is there a good resource for learning how to best use OptimizeIt? I
    > read and understand the user manual, but it doesn't really give me a
    > good handle on how to use the tool effectively.
    >
    > Thanks,
    > John
    nos, Mar 3, 2004
    #2
    1. Advertising

  3. John Raggio

    John Raggio Guest

    You could try to post a reasonable answer instead of trying to be a
    smart ass.

    I did run tests. I was trying to figure out what exactly I should be
    looking for in the results to see how I could filter out those items
    that had to do with class loading and not actual "work". I am new to
    OptimizeIt and am not really sure how to use the tool properly.

    Thanks for your help nos.

    "nos" <> wrote in message news:<bat1c.452323$I06.5073675@attbi_s01>...
    > You could run a test.
    > But I suppose you think it is easier to ask someone else to do it for ya.
    >
    > "John Raggio" <> wrote in message
    > news:...
    > > Is it possible to easily measure class load time ( and any dependent
    > > classes that are subsequently loaded) using OptimizeIt? I am trying
    > > to figure out how big a hit we are taking on app load for class
    > > loading. I'm not even sure if this makes sense, but I want to get a
    > > feel for the CPU time overhead caused by loading classes.
    > >
    > > Is there a good resource for learning how to best use OptimizeIt? I
    > > read and understand the user manual, but it doesn't really give me a
    > > good handle on how to use the tool effectively.
    > >
    > > Thanks,
    > > John
    John Raggio, Mar 4, 2004
    #3
  4. I'm afraid that OptimizeIt cannot solve your problem. But there is
    YourKit Java Profiler (http://www.yourkit.com) that can do. YourKit
    profiler has "CPU Statistics" view. This view shows cumulative time of
    all methods grouped by classes. So you just need to check how long
    ClassLoader's methods work.

    Kind regards,
    Vladimir Kondratyev


    (John Raggio) wrote in message news:<>...
    > Is it possible to easily measure class load time ( and any dependent
    > classes that are subsequently loaded) using OptimizeIt? I am trying
    > to figure out how big a hit we are taking on app load for class
    > loading. I'm not even sure if this makes sense, but I want to get a
    > feel for the CPU time overhead caused by loading classes.
    >
    > Is there a good resource for learning how to best use OptimizeIt? I
    > read and understand the user manual, but it doesn't really give me a
    > good handle on how to use the tool effectively.
    >
    > Thanks,
    > John
    Vladimir Kondratyev, Mar 6, 2004
    #4
  5. John Raggio

    rpadev Guest

    (Vladimir Kondratyev) wrote in
    news::

    > I'm afraid that OptimizeIt cannot solve your problem. But there is
    > YourKit Java Profiler (http://www.yourkit.com) that can do. YourKit
    > profiler has "CPU Statistics" view. This view shows cumulative time of
    > all methods grouped by classes. So you just need to check how long
    > ClassLoader's methods work.
    >
    > Kind regards,
    > Vladimir Kondratyev
    >
    >
    > (John Raggio) wrote in message
    > news:<>...
    >> Is it possible to easily measure class load time ( and any dependent
    >> classes that are subsequently loaded) using OptimizeIt? I am trying
    >> to figure out how big a hit we are taking on app load for class
    >> loading. I'm not even sure if this makes sense, but I want to get a
    >> feel for the CPU time overhead caused by loading classes.
    >>
    >> Is there a good resource for learning how to best use OptimizeIt? I
    >> read and understand the user manual, but it doesn't really give me a
    >> good handle on how to use the tool effectively.
    >>
    >> Thanks,
    >> John


    Vlad:

    Thanks for the reply. I will givce it a look. Now that we are on the
    subject, what is the best way to speed up app start time? Is lazy
    intialization worth the effort?

    --
    ++++++++++++++++++++++++++++++++++++
    RPA - Raggio Pocket PC Applications
    www.theraggios.com/rpa
    ++++++++++++++++++++++++++++++++++++
    rpadev, Mar 6, 2004
    #5
  6. Everything depends on the real problem. First of all you have to find
    startrup bottleneck. IMO class loading is rarely a problem of slow
    startup. Often it's excessive object allocations and heap resizes.
    Lazy initialization of subsystems that are required on startup is very
    good but lazy initialization should not be paranoia :)

    Sincerely,
    Vladimir Kondratyev

    > Thanks for the reply. I will givce it a look. Now that we are on the
    > subject, what is the best way to speed up app start time? Is lazy
    > intialization worth the effort?
    Vladimir Kondratyev, Mar 6, 2004
    #6
  7. John Raggio

    Jon A. Cruz Guest

    Vladimir Kondratyev wrote:
    > I'm afraid that OptimizeIt cannot solve your problem.


    Strange.

    In the past OptimizeIt has help teams I was solve exactly that problem.
    Jon A. Cruz, Mar 6, 2004
    #7
  8. John Raggio

    rpadev Guest

    "Jon A. Cruz" <> wrote in news:404A1F86.1010802
    @joncruz.org:

    > Vladimir Kondratyev wrote:
    >> I'm afraid that OptimizeIt cannot solve your problem.

    >
    > Strange.
    >
    > In the past OptimizeIt has help teams I was solve exactly that problem.
    >
    >
    >


    Jon,

    Could you be a little more specific? Our app has a lrage number of
    classes in it and I suspect that many of them are loaded becasue they
    reference each other. As I understand it, classes are loaded if they are
    referenced and not yet instantiated. Do I have this right? What shoul
    dbe my next move?

    Thanks,
    John

    --
    ++++++++++++++++++++++++++++++++++++
    RPA - Raggio Pocket PC Applications
    www.theraggios.com/rpa
    ++++++++++++++++++++++++++++++++++++
    rpadev, Mar 6, 2004
    #8
  9. John Raggio

    Jon A. Cruz Guest

    Vladimir Kondratyev wrote:
    > I'm afraid that OptimizeIt cannot solve your problem. But there is
    > YourKit Java Profiler (http://www.yourkit.com) that can do. YourKit
    > profiler has "CPU Statistics" view. This view shows cumulative time of
    > all methods grouped by classes. So you just need to check how long
    > ClassLoader's methods work.


    To explain a little more why I was suspicious of this claim, I just did
    a google search and third item listed had some info

    http://info.borland.com/techpubs/optimizeit/optimizeit6/thread_debugger/setting_up.html

    Under "Choosing operation options"

    # Auto-start Analyzer starts the monitor usage analyzer before executing
    the tested program main() method. Use this option to include the program
    startup phase, like the class loading, in the analysis.




    Sorry I couldn't be more specific at first. It's been a while since my
    team did the optimization on the product.
    Jon A. Cruz, Mar 6, 2004
    #9
  10. John Raggio

    Jon A. Cruz Guest

    rpadev wrote:
    > Jon,
    >
    > Could you be a little more specific? Our app has a lrage number of
    > classes in it and I suspect that many of them are loaded becasue they
    > reference each other. As I understand it, classes are loaded if they are
    > referenced and not yet instantiated. Do I have this right? What shoul
    > dbe my next move?


    Uh oh. You're using a naughty word.

    "suspect"

    :)

    That's a big no-no when it comes to performance. Studies have shown that
    developer intuition is wrong the majority of the time when it comes to
    optimization.

    Probably the first thing of all is to measure what's going on. Instead
    of guessing, check. As Vladimir pointed out, there are probably actually
    two things going on in your situation.

    Problem: "My program is slow to start"

    Off hand, I'd say that most the time could be from two causes
    1) Class loading is slow.
    2) Application state and initialization/construction is slow.

    So, keeping in mind that there are probably two different things going
    on, you'll probably want to start getting measurements of both.


    One thing to do is to check/dump the time as the first thing inside of
    your main(). Then maybe dump it at the end also.

    Another thing to do is to decouple your app's class loading from Java
    startup itself. The simple way is to have a bare class that does not
    reference any other classes at all. Inside the main of your launcher
    stub dump the time, then use reflection to load your real main class.
    dump the time again. Then instantiate your main class. Dump the time again.

    Start measuring things. Broken apart like that, and with the two
    different issues in mind, it should help with profiling.

    IIRC, the main thing that might be slowing class loading is static
    initializers. See if you have static blocks, or if you have static
    variables initialized to a new instance of any classes.


    Again, first start by splitting java starting from your classes and look
    at where the big numbers fall. Then after that start to hunt down.


    *THEN*, after all that is done and you have loads of wall-clock and
    profiled measurments, then it will be safe to start thinking about
    optimizing and whether or not things will improve your performance.
    Since by that point you'll have all sorts of metrics, it will be easy to
    A) see what needs improving, and B) see which things have either
    negative, positive or negligible.
    Jon A. Cruz, Mar 7, 2004
    #10
  11. John Raggio

    rpadev Guest

    "Jon A. Cruz" <> wrote in
    news::

    > Vladimir Kondratyev wrote:
    >> I'm afraid that OptimizeIt cannot solve your problem. But there is
    >> YourKit Java Profiler (http://www.yourkit.com) that can do. YourKit
    >> profiler has "CPU Statistics" view. This view shows cumulative time
    >> of all methods grouped by classes. So you just need to check how long
    >> ClassLoader's methods work.

    >
    > To explain a little more why I was suspicious of this claim, I just
    > did a google search and third item listed had some info
    >
    > http://info.borland.com/techpubs/optimizeit/optimizeit6/thread_debugger
    > /setting_up.html
    >
    > Under "Choosing operation options"
    >
    > # Auto-start Analyzer starts the monitor usage analyzer before
    > executing the tested program main() method. Use this option to include
    > the program startup phase, like the class loading, in the analysis.
    >
    >
    >
    >
    > Sorry I couldn't be more specific at first. It's been a while since my
    > team did the optimization on the product.
    >


    Thanks for the response and for your time. I will dig in on this Monday.
    our other post was also helpful.

    John

    --
    ++++++++++++++++++++++++++++++++++++
    RPA - Raggio Pocket PC Applications
    www.theraggios.com/rpa
    ++++++++++++++++++++++++++++++++++++
    rpadev, Mar 7, 2004
    #11
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark
    Replies:
    2
    Views:
    459
  2. Wes Harrison

    Measuring a short interval in time

    Wes Harrison, Sep 14, 2004, in forum: Java
    Replies:
    2
    Views:
    568
    Paul Lutus
    Sep 14, 2004
  3. NOBODY
    Replies:
    11
    Views:
    555
    Robert Klemme
    Nov 10, 2004
  4. Brinda Maiti via JavaKB.com

    Optimizeit usage

    Brinda Maiti via JavaKB.com, Jan 21, 2005, in forum: Java
    Replies:
    0
    Views:
    353
    Brinda Maiti via JavaKB.com
    Jan 21, 2005
  5. Jeremy Watts
    Replies:
    3
    Views:
    67,309
    Jeremy Watts
    Jun 14, 2005
Loading...

Share This Page