Newsgroup: comp.lang.java.programmer


Date: Mon, 24 Apr 2006 10:51:54 +0300
From: Diomidis Spinellis <dds@aueb.gr>
Organization: Athens University of Economics and Business
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.2) Gecko/20060404 SeaMonkey/1.0.1
MIME-Version: 1.0
Newsgroups: comp.lang.java.programmer
Subject: Re: strange performance behavior of a mathematical method: why?
References: <1145823428.424885.264990@u72g2000cwu.googlegroups.com> <e2grdf$2bf$1@volcano1.grnet.gr> <1145828078.019089.116170@i39g2000cwa.googlegroups.com>
In-Reply-To: <1145828078.019089.116170@i39g2000cwa.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Dimitri Ognibene wrote:
> what do you tjink of this method implementation?
> any tip?
> must i pass to c++ & asm to get better performance?
> note that the g method called inside the loop is final and the compiler
> does inline it, or it looks to be so from the profiling data.

 From what I can see this particular code manipulates floating point 
numbers.  This is one of the (not common) cases where a good Java 
compiler and JIT-based runtime system should be able to give you the 
same performance as the one you would achieve with (say) C.

You are unlikely to gain anything from moving to assembly, unless you 
can utilize instructions that compilers don't typically support.  For 
example, I see that your code calculates some type of dot product: if 
your data allows it, you could gain by using Intel's SSE SIMD extensions 
or AMD's 3DNow.  Another possibility would be to move your code to be 
executed by a 3D graphic card's hardware.

-- 
Diomidis Spinellis
Code Quality: The Open Source Perspective (Addison-Wesley 2006)
http://www.spinellis.gr/codequality?cljp



Newsgroup comp.lang.java.programmer contents
Newsgroup list
Diomidis Spinellis home page

Creative Commons License Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-Share Alike 3.0 Greece License.