Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Measuring Class Load Time Using OptimizeIt

Reply
Thread Tools

Measuring Class Load Time Using OptimizeIt

 
 
John Raggio
Guest
Posts: n/a
 
      03-03-2004
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
 
Reply With Quote
 
 
 
 
nos
Guest
Posts: n/a
 
      03-03-2004
You could run a test.
But I suppose you think it is easier to ask someone else to do it for ya.

"John Raggio" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) m...
> 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



 
Reply With Quote
 
 
 
 
John Raggio
Guest
Posts: n/a
 
      03-04-2004
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" <(E-Mail Removed)> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) m...
> > 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

 
Reply With Quote
 
Vladimir Kondratyev
Guest
Posts: n/a
 
      03-06-2004
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


http://www.velocityreviews.com/forums/(E-Mail Removed) (John Raggio) wrote in message news:<(E-Mail Removed) om>...
> 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

 
Reply With Quote
 
rpadev
Guest
Posts: n/a
 
      03-06-2004
(E-Mail Removed) (Vladimir Kondratyev) wrote in
news:(E-Mail Removed) om:

> 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
>
>
> (E-Mail Removed) (John Raggio) wrote in message
> news:<(E-Mail Removed) om>...
>> 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
++++++++++++++++++++++++++++++++++++
 
Reply With Quote
 
Vladimir Kondratyev
Guest
Posts: n/a
 
      03-06-2004
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?

 
Reply With Quote
 
Jon A. Cruz
Guest
Posts: n/a
 
      03-06-2004
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.


 
Reply With Quote
 
rpadev
Guest
Posts: n/a
 
      03-06-2004
"Jon A. Cruz" <(E-Mail Removed)> 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
++++++++++++++++++++++++++++++++++++
 
Reply With Quote
 
Jon A. Cruz
Guest
Posts: n/a
 
      03-06-2004
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/opt...etting_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.

 
Reply With Quote
 
Jon A. Cruz
Guest
Posts: n/a
 
      03-07-2004
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
measuring the execution time of a java method Jeremy Watts Java 3 06-14-2005 09:07 AM
Optimizeit usage Brinda Maiti via JavaKB.com Java 0 01-21-2005 12:26 PM
optimizeit: how to workaround/minimize wrong cput time in Object.wait() NOBODY Java 11 11-10-2004 03:31 PM
Measuring a short interval in time Wes Harrison Java 2 09-14-2004 05:04 PM
Optimizeit on Tomcat crashes JVM Mark Java 2 10-29-2003 01:23 AM



Advertisments