You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gilles (Created) (JIRA)" <ji...@apache.org> on 2011/10/09 02:25:29 UTC

[jira] [Created] (MATH-688) "FastMath" contains fractions of constants

"FastMath" contains fractions of constants
------------------------------------------

                 Key: MATH-688
                 URL: https://issues.apache.org/jira/browse/MATH-688
             Project: Commons Math
          Issue Type: Improvement
            Reporter: Gilles
            Assignee: Gilles
            Priority: Trivial
             Fix For: 3.0


Fractions such as 1.0 / 3.0, 1.0 / 5.0, ... could be replaced with static final constants.
In "asinh", for example, the change can sometimes result in more than halving the computation time (when the argument is in the range of values where the constants are used).

In absolute times, the gain is not huge, amounting to something like 5 ms for 10 million computations.

And, of course, the downside will be that these values will be computed at the loading of "FastMath", leading to an additional penalty of about 16 divisions at initialization... :)


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (MATH-688) "FastMath" contains fractions of constants

Posted by "Gilles (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gilles resolved MATH-688.
-------------------------

    Resolution: Fixed

Revision 1181175.
                
> "FastMath" contains fractions of constants
> ------------------------------------------
>
>                 Key: MATH-688
>                 URL: https://issues.apache.org/jira/browse/MATH-688
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Gilles
>            Assignee: Gilles
>            Priority: Trivial
>             Fix For: 3.0
>
>
> Fractions such as 1.0 / 3.0, 1.0 / 5.0, ... could be replaced with static final constants.
> In "asinh", for example, the change can sometimes result in more than halving the computation time (when the argument is in the range of values where the constants are used).
> In absolute times, the gain is not huge, amounting (on my machine) to something like 370 ms for 10 million computations.
> And, of course, the downside will be that these constants will be computed at the loading of "FastMath", leading to an additional penalty of about 16 divisions at initialization... :)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-688) "FastMath" contains fractions of constants

Posted by "Sebb (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13123811#comment-13123811 ] 

Sebb commented on MATH-688:
---------------------------

AFAIK, the calculations will be done at compile time.
                
> "FastMath" contains fractions of constants
> ------------------------------------------
>
>                 Key: MATH-688
>                 URL: https://issues.apache.org/jira/browse/MATH-688
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Gilles
>            Assignee: Gilles
>            Priority: Trivial
>             Fix For: 3.0
>
>
> Fractions such as 1.0 / 3.0, 1.0 / 5.0, ... could be replaced with static final constants.
> In "asinh", for example, the change can sometimes result in more than halving the computation time (when the argument is in the range of values where the constants are used).
> In absolute times, the gain is not huge, amounting (on my machine) to something like 370 ms for 10 million computations.
> And, of course, the downside will be that these constants will be computed at the loading of "FastMath", leading to an additional penalty of about 16 divisions at initialization... :)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (MATH-688) "FastMath" contains fractions of constants

Posted by "Sebb (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13123811#comment-13123811 ] 

Sebb edited comment on MATH-688 at 10/10/11 10:22 AM:
------------------------------------------------------

bq. the downside will be that these constants will be computed at the loading of "FastMath"

AFAIK, the constant calculations will be done at compile time.
                
      was (Author: sebb@apache.org):
    AFAIK, the calculations will be done at compile time.
                  
> "FastMath" contains fractions of constants
> ------------------------------------------
>
>                 Key: MATH-688
>                 URL: https://issues.apache.org/jira/browse/MATH-688
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Gilles
>            Assignee: Gilles
>            Priority: Trivial
>             Fix For: 3.0
>
>
> Fractions such as 1.0 / 3.0, 1.0 / 5.0, ... could be replaced with static final constants.
> In "asinh", for example, the change can sometimes result in more than halving the computation time (when the argument is in the range of values where the constants are used).
> In absolute times, the gain is not huge, amounting (on my machine) to something like 370 ms for 10 million computations.
> And, of course, the downside will be that these constants will be computed at the loading of "FastMath", leading to an additional penalty of about 16 divisions at initialization... :)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-688) "FastMath" contains fractions of constants

Posted by "Gilles (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13123984#comment-13123984 ] 

Gilles commented on MATH-688:
-----------------------------

If so, how would you explain the benchmark result?

                
> "FastMath" contains fractions of constants
> ------------------------------------------
>
>                 Key: MATH-688
>                 URL: https://issues.apache.org/jira/browse/MATH-688
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Gilles
>            Assignee: Gilles
>            Priority: Trivial
>             Fix For: 3.0
>
>
> Fractions such as 1.0 / 3.0, 1.0 / 5.0, ... could be replaced with static final constants.
> In "asinh", for example, the change can sometimes result in more than halving the computation time (when the argument is in the range of values where the constants are used).
> In absolute times, the gain is not huge, amounting (on my machine) to something like 370 ms for 10 million computations.
> And, of course, the downside will be that these constants will be computed at the loading of "FastMath", leading to an additional penalty of about 16 divisions at initialization... :)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MATH-688) "FastMath" contains fractions of constants

Posted by "Gilles (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gilles updated MATH-688:
------------------------

    Description: 
Fractions such as 1.0 / 3.0, 1.0 / 5.0, ... could be replaced with static final constants.
In "asinh", for example, the change can sometimes result in more than halving the computation time (when the argument is in the range of values where the constants are used).

In absolute times, the gain is not huge, amounting (on my machine) to something like 370 ms for 10 million computations.

And, of course, the downside will be that these constants will be computed at the loading of "FastMath", leading to an additional penalty of about 16 divisions at initialization... :)


  was:
Fractions such as 1.0 / 3.0, 1.0 / 5.0, ... could be replaced with static final constants.
In "asinh", for example, the change can sometimes result in more than halving the computation time (when the argument is in the range of values where the constants are used).

In absolute times, the gain is not huge, amounting to something like 5 ms for 10 million computations.

And, of course, the downside will be that these values will be computed at the loading of "FastMath", leading to an additional penalty of about 16 divisions at initialization... :)


    
> "FastMath" contains fractions of constants
> ------------------------------------------
>
>                 Key: MATH-688
>                 URL: https://issues.apache.org/jira/browse/MATH-688
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Gilles
>            Assignee: Gilles
>            Priority: Trivial
>             Fix For: 3.0
>
>
> Fractions such as 1.0 / 3.0, 1.0 / 5.0, ... could be replaced with static final constants.
> In "asinh", for example, the change can sometimes result in more than halving the computation time (when the argument is in the range of values where the constants are used).
> In absolute times, the gain is not huge, amounting (on my machine) to something like 370 ms for 10 million computations.
> And, of course, the downside will be that these constants will be computed at the loading of "FastMath", leading to an additional penalty of about 16 divisions at initialization... :)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-688) "FastMath" contains fractions of constants

Posted by "Gilles (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13123996#comment-13123996 ] 

Gilles commented on MATH-688:
-----------------------------

OK, I now understand that there is no problem making the change then.

                
> "FastMath" contains fractions of constants
> ------------------------------------------
>
>                 Key: MATH-688
>                 URL: https://issues.apache.org/jira/browse/MATH-688
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Gilles
>            Assignee: Gilles
>            Priority: Trivial
>             Fix For: 3.0
>
>
> Fractions such as 1.0 / 3.0, 1.0 / 5.0, ... could be replaced with static final constants.
> In "asinh", for example, the change can sometimes result in more than halving the computation time (when the argument is in the range of values where the constants are used).
> In absolute times, the gain is not huge, amounting (on my machine) to something like 370 ms for 10 million computations.
> And, of course, the downside will be that these constants will be computed at the loading of "FastMath", leading to an additional penalty of about 16 divisions at initialization... :)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira