[
https://issues.apache.org/jira/browse/MATH-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13102190#comment-13102190
]
Gilles commented on MATH-650:
-----------------------------
Now, for {{pow}} (which makes use of the tables).
*Single call*
_--- Current revision (preset arrays) ---_
{noformat}
pow (runs per timed block: 1, timed blocks: 1)
StrictMath: 3.505750e-01 (0.000000e+00) ms
Math: 1.212800e-02 (0.000000e+00) ms
FastMath: 1.615966e+01 (0.000000e+00) ms
{noformat}
_--- Current revision (computed arrays) ---_
{noformat}
pow (runs per timed block: 1, timed blocks: 1)
StrictMath: 3.744040e-01 (0.000000e+00) ms
Math: 1.167500e-02 (0.000000e+00) ms
FastMath: 6.009579e+01 (0.000000e+00) ms
{noformat}
*100 calls*
_--- Current revision (preset arrays) ---_
{noformat}
pow (runs per timed block: 10, timed blocks: 10)
StrictMath: 4.989190e-03 (1.327046e-02) ms
Math: 9.002900e-04 (3.572090e-04) ms
FastMath: 1.766465e-01 (5.395676e-01) ms
{noformat}
_--- Current revision (computed arrays) ---_
{noformat}
pow (runs per timed block: 10, timed blocks: 10)
StrictMath: 4.825060e-03 (1.264487e-02) ms
Math: 8.913100e-04 (3.244602e-04) ms
FastMath: 6.132025e-01 (1.920372e+00) ms
{noformat}
*1_000_000 calls*
_--- Current revision (preset arrays) ---_
{noformat}
pow (runs per timed block: 10000, timed blocks: 100)
StrictMath: 3.579742e-04 (5.042732e-05) ms
Math: 3.488973e-04 (2.601644e-05) ms
FastMath: 2.985653e-04 (5.704499e-04) ms
{noformat}
_--- Current revision (computed arrays) ---_
{noformat}
pow (runs per timed block: 10000, timed blocks: 100)
StrictMath: 3.574941e-04 (4.608201e-05) ms
Math: 3.520267e-04 (2.770605e-05) ms
FastMath: 3.399842e-04 (1.001058e-03) ms
{noformat}
One can see that using preset arrays is indeed faster. The ratio of times
(calling {{pow}} either using preset or using computed arrays):
* 1 call: 0.27
* 100 calls: 0.29
* 1000000 calls: 0.88
Do the above results warrant to triple the size of the source file? IMO, no.
We are not dealing with a "few seconds" of absolute running time: For each of
the 3 runs (single call, one hundred and one million calls), we gain no more
than about 45 milliseconds!
> 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