-
-
Notifications
You must be signed in to change notification settings - Fork 69
Use Cython to wrap C overlap area code #22
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
Conversation
|
@cdeil - thanks for working on this! I can review tomorrow. In the mean time it seems like this needs rebasing on master though, as it says it can't be merged. Maybe you were working off an old master? |
.travis.yml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make this 0.19.1 since that is the version we have a wheel binary for?
|
Rebased and changed to Cython |
|
@cdeil - I just did some performance tests, and the results are very impressive! If I write a pure-C code as follows: and call computeOverlap 1e7 times, I get: (compiled with clang -O3 which is what Cython uses). If I write a Python code as follows: I get: In other words, you are within 5% of the theoretical maximum, which is about as good as I've ever seen Cython. This looks great to me! Do we want to allow |
|
By the way, I'll work on trying to add the performance benchmarks to the package. |
|
I think There should probably be some call like |
|
@cdeil - I guess you're right it can be considered an expert function. In fact, to keep the Cython as simple as possible, how about making the Cython function private ( |
|
I first had this extra layer of a I'm not against introducing the extra layer, I just don't see the advantage of introducing it yet. Let me know if you think making the change would be an improvement and I'll do it. |
|
Well I guess I don't know enough about Cython to know whether doing all this extra stuff in the Cython layer would cause it to not be as fast. And I don't think we can add the multiprocessing stuff to the Cython file but I may be wrong. I would personally prefer having an extra pure-Python layer. |
|
OK, I've added the wrapper as discussed. |
|
@cdeil - the issue is in the |
|
Thanks for the tip, fixed now. Let me know if there's something else that should go in this PR. |
|
@cdeil - looks great, thanks! |
Use Cython to wrap C overlap area code
This is a first attempt to implement #19, i.e. to switch the existing wrapper to Cython.
@astrofrog I really don't know Cython and am probably doing a few things wrong. Could you please have a look and comment?
I'll go read some Cython tutorial now and give this another shot tomorrow.