[
https://issues.apache.org/jira/browse/MATH-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13100221#comment-13100221
]
Gilles commented on MATH-650:
-----------------------------
{quote}
In my tests, I found that pre-calculating the data is about twice as fast as
calculating it in the static block.
That seems a worthwhile improvement to me.
{quote}
Could you provide the absolute numbers?
What I contend is that we should not base this change on an extremely unlikely
use-case: Launching a JVM for an application that will run for a few seconds of
is very costly, and the additional cost of initializing "FastMath" must be
compared to the overall initialization time.
What I said in the previous comment is that IOD is _fine_ to use, if only
because it will avoid unnecessary memory usage, which might benefit
light-weight applications (_light-weight_ is a much more interesting use-case
than _short-lived_).
I don't like having tables that huge in the source code just for the sake of
saving a few seconds.
(If the data were coming from an external source or were really taking a lot of
time to compute, that would be a necessity. But not in this case.)
So, could you please post the timings (also, the total initialization time of
the JVM) of
* using neither IOD nor preset arrays
* using IOD, but no preset arrays
* using IOD with preset arrays
Thanks in advance.
> 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