[ 
https://issues.apache.org/jira/browse/MATH-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13206188#comment-13206188
 ] 

Luc Maisonobe edited comment on MATH-650 at 2/11/12 5:27 PM:
-------------------------------------------------------------

I think the reason literal array are faster is that there is no real reading 
(no file to open, no loop, no read ...). Everything has already been prepared 
beforehand by the compiler and the loaded class is most probably already in a 
memory-mapped file. Remember that the array are literal and need to be parsed 
only by the compiler, not by the JVM at loading time. In fact in both cases 
what is loaded is binary.
                
      was (Author: luc):
    I think the reason literal array are faster is that they is no real reading 
(no file to open, no loop, no read ...). Everything has already been prepared 
beforehand by the compiler and the loaded class is most probably already in a 
memory-mapped file. Remember that the array are literal and need to be parsed 
only by the compiler, not by the JVM at loading time. In fact in both cases 
what is loaded is binary.
                  
> FastMath has static code which slows the first access to FastMath
> -----------------------------------------------------------------
>
>                 Key: MATH-650
>                 URL: https://issues.apache.org/jira/browse/MATH-650
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: Nightly Builds
>         Environment: Android 2.3 (Dalvik VM with JIT)
>            Reporter: Alexis Robert
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMathLoadCheck.java, LucTestPerformance.java
>
>
> Working on an Android application using Orekit, I've discovered that a simple 
> FastMath.floor() takes about 4 to 5 secs on a 1GHz Nexus One phone (only the 
> first time it's called). I've launched the Android profiling tool (traceview) 
> and the problem seems to be linked with the static portion of FastMath code 
> named "// Initialize tables"
> The timing resulted in :
> - FastMath.slowexp (40.8%)
> - FastMath.expint (39.2%)
>  \- FastMath.quadmult() (95.6% of expint)
> - FastMath.slowlog (18.2%)
> Hoping that would help
> Thanks!
> Alexis Robert

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to