commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <>
Subject [jira] [Commented] (MATH-1113) "FastMath.atan" is slow
Date Tue, 25 Mar 2014 18:18:16 GMT


Gilles commented on MATH-1113:

bq. both "FastMath.atan2" and "FastMath.atan" call the internal method

Yes, that's the correct statement. Sorry.

I agree with the explanation.
I should have stated the issue differently: If "FastMath" is a faster "Math", then it can
never be slower.
In another library, there is a version of "atan2" that is much faster than "FastMath.atan2";
it internally calls "Math.atan".

So the question is eventually: Why is "FastMath.atan" significantly slower than "Math.atan"?

If there is no way for performance improvement while sticking to the stated accuracy (by tweaking
the current code), we should think about renaming the class. We should also figure out how
to allow users to trade off accuracy for speed.

It's a pity that application developers must be careful of which "Math" methods there are
going to replace with the "FastMath" equivalent.
And "atan" is not the worst case...

> "FastMath.atan" is slow
> -----------------------
>                 Key: MATH-1113
>                 URL:
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.2
>            Reporter: Gilles
>            Priority: Minor
>              Labels: perfomance
>             Fix For: 3.3
> This issue is related to
>   MATH-740
>   MATH-901
> Micro-benchmarks show that "FastMath.atan2" is faster than "Math.atan2" but that "FastMath.atan"
is slower than "Math.atan". However, both "FastMath.atan2" and "Math.atan" call the internal
method "FastMath.atan(double,double,boolean)".
> It seems that some performance improvement could be achieved, through understanding why
the results seem contradictory.

This message was sent by Atlassian JIRA

View raw message