New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slow CDF fast_callable powers #12513
Comments
comment:2
Apply only 12513-cdf-pow-5.4.patch |
comment:3
|
comment:4
Oops. Crazily enough, it interprets that as a label (so no compile error) and falls through to the base case (which also give the correct result, albeit slower). |
Attachment: 12513-cdf-pow-5.4.3.patch.gz apply only this patch |
comment:5
Added some explicit tests of this codepath. |
comment:6
Ah, I was wondering how it could compile. I guess you could have added a goto just to round it out :). How does it know that the defualt: starts the base case? Are you sure it falls through to that? According to http://msdn.microsoft.com/en-us/library/66k51h7a(v=vs.80).aspx (Microsoft, I know...), for example, it seems that the default code would not be executed, "If the default statement is omitted, and no case match is found, none of the statements in the switch body are executed." |
comment:7
The "defualt" statement was not executed, so it falls all the way down to the last line |
comment:8
Oh, right. I thought you meant the base case for the switch statement. |
comment:9
This looks excellent. I haven't tried the patch yet, but I noticed that you hard-code the integer range:
I'm not sure how platform independent that is. I think there's a preprocessor macro like |
comment:10
Thanks for taking a look. Yes, INT_MAX is defined in stdint.c, but this is Python. (Note that sys.maxint is the wrong thing to use here, as that's the max value of a long.) The C standard mandates at least 16 bits, but I don't know of any (modern) processors that have less than 32-bit ints (including mobile processors like ARM). Really, it's just the same bounds that are being used elsewhere in this file. |
Reviewer: tkluck |
comment:11
If there's no way in Cython to get the integer range, then I guess we should just leave it like this. I've tested the patch and it works as advertised. The doctests work, too. I'll give this a positive review. |
Changed reviewer from tkluck to Timo Kluck |
comment:13
Using the C99 constant |
Changed reviewer from Timo Kluck to Timo Kluck, Jeroen Demeyer |
comment:15
Attachment: 12513_solaris.patch.gz |
This comment has been minimized.
This comment has been minimized.
comment:16
"isn't as portable as it should be" yeah, it's a pretty basic part of the standard. It's sad when standard compliant code != portable code. I assume you've tested this on solaris? If so, looks good to me. (Probably wouldn't hurt to have a solaris patchbot running...) |
Merged: sage-5.5.beta1 |
Before
which is still better than
but nowhere close to
Apply attachment: 12513-cdf-pow-5.4.3.patch and attachment: 12513_solaris.patch
CC: @jasongrout
Component: numerical
Author: Robert Bradshaw
Reviewer: Timo Kluck, Jeroen Demeyer
Merged: sage-5.5.beta1
Issue created by migration from https://trac.sagemath.org/ticket/12513
The text was updated successfully, but these errors were encountered: