-
-
Notifications
You must be signed in to change notification settings - Fork 11
Rough Draft Idea For Migrating Propcache to CPython #125
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
base: master
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
class Py_Is(Operation): | ||
NAME = "Py_Is" | ||
|
||
def replace2(regs): |
Check notice
Code scanning / CodeQL
First parameter of a method is not named 'self' Note
# FIXME: add macro after the first header comment | ||
# FIXME: add macro after includes | ||
# FIXME: add macro after: #define PY_SSIZE_T_CLEAN | ||
return line + "\n" + content |
Check notice
Code scanning / CodeQL
Explicit returns mixed with implicit (fall through) returns Note
encoding = "utf-8" | ||
errors = "surrogateescape" | ||
|
||
with open(filename, encoding=encoding, errors=errors) as fp: |
Check notice
Code scanning / CodeQL
Empty except Note
Personally, I don't think we should be writing anything new in C. We should be using Cython or Rust. But, I'll leave this to bdraco to decide where the project should go. |
I think we should only consider C if we can see a 50% or better speed up |
What do these changes do?
I moved Propcache to C out of pure boredom/inspiration from having worked a bit on the multidict project for a time so I felt a little bit confident that I could at least pull this off as an outlined plan for optimizing propcache's properties a bit further.
This however is a rough-draft/blue-print idea and like all should be treated as one. I do not expect to do anything with it for the time being and you should treat it as experimental until I am ready to actually begin merging it to it and start replacing the cython script in favor of it.
We will need to add clang-format to pre-commit before we wish to proceed with this large change and I don't expect for this to be implemented until after 0.3.3 has been rolled out.
Edit: Please know that I am a little bit unskilled with writing CPython all by myself so this rough draft might have a few hiccups in the C Code.
Are there changes in behavior for the user?
Should be a little bit more performance now that
NULL
could be utilized a bit elsewhere. I doubt anyone is going to want a C-API Capsule like I and avetlov are doing to multidict so there may not be a need for one (unless cython starts supporting stuff like it which would be an extremely rare case scenario, incase I made it so that true means success and false indicates failure in a few places in the main header filepc.h
).Related issue number
Checklist