commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (Commented) (JIRA)" <>
Subject [jira] [Commented] (MATH-650) FastMath has static code which slows the first access to FastMath
Date Sat, 11 Feb 2012 17:13:00 GMT


Gilles commented on MATH-650:

I'm surprised though that binary files take longer to load than litteral. I should have thought
that reading a presumably longer table, and parsing a presumably larger number of octets for
each double would result in a longer loading time. I must have missed something.

Thank you for asking! ;)

I also raised this puzzling point on the ML, after having implemented the resource loading
approach following a suggestion by Ted Dunning, who also had hinted that it would be faster.
Nobody came up with an explanation about why the implementation is indeed slower. I'd have
said that
* either there is a bug in my implementation (in the sense that is not done correctly to get
the best performance from this approach) and it would nice and useful to find what is wrong
* or the loading of big literal arrays is faster and it would be interesting to know why,
in order to rectify the conventional wisdom that had us believe otherwise.

> 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