commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (Commented) (JIRA)" <>
Subject [jira] [Commented] (MATH-650) FastMath has static code which slows the first access to FastMath
Date Tue, 29 Nov 2011 15:22:43 GMT


Sebb commented on MATH-650:

I think the code should not be released with multiple implementations.
These have been very useful for testing purposes, but are unnecessary and potentially confusing
for end-users.

If it is desired to keep the alternate implementations, these could perhaps be moved elsewhere
in the directory structure.


However, I don't think the resources solution is ideal. It requires additional supporting
code, the data files are not readable, and is not always as fast as the arrays. It also requires
large amounts of temporary stack use when loading the arrays.

Its only advantage as far as I can tell is that it means the arrays can be private to FastMath.
This could be fixed for the static array case by using element getters rather than providing
access to the entire arrays.
If this proves workable performance-wise, that would be just as good for me as the original
local arrays.
My second choice is external arrays with direct access rather than getters (as is done at
> FastMath has static code which slows the first access to FastMath
> -----------------------------------------------------------------
>                 Key: MATH-650
>                 URL:
>             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:,
> 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:!default.jspa
For more information on JIRA, see:


View raw message