-
-
Notifications
You must be signed in to change notification settings - Fork 748
Annotate extract_serialize (for Cythonization)
#4283
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
Provides some unintrusive type annotations of variables in `extract_serialize`. Cython is able to parse these type annotations and optimize the code. Though as the type annotations are already supported in Python normally, this remains valid Python code that is otherwise unaffected.
|
As a PR this seems fine to me. At a larger scale it would obviously be grand if we could avoid having pyx files. My guess is that this will be hard to achieve while still getting optimal performance. I'd be very happy to learn otherwise though. |
|
Right. I want to see how far we get with this strategy as...
At least when I looked at the code this generated in C, it was pretty much as good as I would get even if I wrote it in Cython. My guess is pure Python mode in Cython has grown a lot since when Antoine and yourself last tried. So it seems worth exploring again for that reason alone (in addition to the benefits listed above). If we still find we need |
jrbourbeau
left a comment
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.
Let's give this a shot, thanks @jakirkham
|
Thanks all! 😄 |
|
This approach excites me. I would be very happy if I could continue developing the scheduler in pure Python. |
This adds some unintrusive type annotations to
extract_serializeso that when Cythonizing this function, we can get optimal performance out of it. If run only as pure Python, the performance remains the same.Pure Python:
Cython: