Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Performance G4 --> G5



> When I started comparing the client vs server performance I had a 
> program that took 1 minute
> of CPU time with the client compiler and also 1 minute with the server 
> compiler. But when
> I ran it with profiling turned on (-Xprof) I noticed that the client 
> compiler was spending 10s
> on compilation and 50s on execution, while the server compiler spent 
> 30s on compilation
> and 30s on execution. Then I decided to try my program on something 
> that would require
> much more than 1 minute to execute, and the result was that the client 
> compiler still spent
> 10s on compilation while the server compiler spent about 30s on 
> compilation, but the total
> execution time with the server compiler was less than half the time 
> needed with client compiler.

> I assume this is because the server compiler does much more agressive 
> optimizations which
> require more cpu time but produce better code. In my case the program 
> was about 25,000 lines
> long, but the really cpu intensive part is about 1,000 lines.

This suggests that the appropriate long term solution might be a compiler directive that lets the programmer tell the compiler which classes or methods are likely to benefit from heavy optimization. It's an old rule of thumb that programs spend 90% of their time in 10% of the code; if the programer either knows via a profiler, or has a good guess from experience, where that 10% is, optimizing it would give better performance overall.

So why not do this on every program? Java is pretty slow starting up now. In fact, I wouldn't mind _reducing_ the optimization on classes like dialogs if that would mean they could load faster.

An automated alternative might be a compiler that does little or no optimization the first time a method is used, then increases the optimization on subsequent executions based on some internal formula that takes execution time, length of code and the number of executions into account. Maybe the JVM already does this; I don't know.

Mike Westerfield
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.