commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MATH-650) FastMath has static code which slows the first access to FastMath
Date Sun, 11 Sep 2011 00:53:08 GMT

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

Gilles commented on MATH-650:
-----------------------------

Answering my own question using code committed in revision 1167657.

*Single call*
_--- Previous revision ---_
{noformat}
floor (runs per timed block: 1, timed blocks: 1)
     StrictMath: 5.232920e-01 (0.000000e+00) ms
           Math: 1.188100e-02 (0.000000e+00) ms
       FastMath: 4.942540e+00 (0.000000e+00) ms
{noformat}
_--- Current revision (preset arrays) ---_
{noformat}
floor (runs per timed block: 1, timed blocks: 1)
     StrictMath: 5.290030e-01 (0.000000e+00) ms
           Math: 1.201200e-02 (0.000000e+00) ms
       FastMath: 4.871144e+00 (0.000000e+00) ms
{noformat}
_--- Current revision (computed arrays) ---_
{noformat}
floor (runs per timed block: 1, timed blocks: 1)
     StrictMath: 5.150580e-01 (0.000000e+00) ms
           Math: 1.236000e-02 (0.000000e+00) ms
       FastMath: 4.938346e+00 (0.000000e+00) ms
{noformat}

*100 calls*
_--- Previous revision ---_
{noformat}
floor (runs per timed block: 10, timed blocks: 10)
     StrictMath: 6.119510e-03 (1.700389e-02) ms
           Math: 8.260500e-04 (3.575574e-04) ms
       FastMath: 5.001669e-02 (1.563012e-01) ms
{noformat}
_--- Current revision (preset arrays) ---_
{noformat}
floor (runs per timed block: 10, timed blocks: 10)
     StrictMath: 6.157360e-03 (1.718482e-02) ms
           Math: 8.144700e-04 (3.643913e-04) ms
       FastMath: 4.921887e-02 (1.537010e-01) ms
{noformat}
_--- Current revision (computed arrays) ---_
{noformat}
floor (runs per timed block: 10, timed blocks: 10)
     StrictMath: 7.027420e-03 (1.983324e-02) ms
           Math: 9.193500e-04 (3.579075e-04) ms
       FastMath: 4.789965e-02 (1.498412e-01) ms
{noformat}

So, at startup,
* it takes about the same time to call {{floor}} once and 100 times,
* there is no difference between using preset arrays or computing them ({{floor}} does not
need the arrays, so they are not initialized).


> 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
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message