Migrate to a C extension for better performance#710
Migrate to a C extension for better performance#710Vizonex wants to merge 4 commits intoaio-libs:masterfrom
Conversation
| # def __mul__(self, value): | ||
| # return self.__class__(self._items.__mul__(value)) |
Check notice
Code scanning / CodeQL
Commented-out code Note
| # def __mul__(self, value): | ||
| # return self.__class__(self._items.__mul__(value)) | ||
|
|
||
| def __imul__(self, value): |
Check notice
Code scanning / CodeQL
Non-standard exception raised in special method Note
| # def __rmul__(self, value): | ||
| # return self.__class__(self._items.__rmul__(value)) | ||
|
|
||
| # def __add__(self, value): | ||
| # return self.__class__(self._items.__add__(value)) |
Check notice
Code scanning / CodeQL
Commented-out code Note
| def __contains__(self, value): | ||
| return self._items.__contains__(value) | ||
|
|
||
| def __iadd__(self, values): |
Check notice
Code scanning / CodeQL
Non-standard exception raised in special method Note
| 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
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #710 +/- ##
==========================================
+ Coverage 94.90% 98.85% +3.95%
==========================================
Files 10 2 -8
Lines 726 350 -376
Branches 48 26 -22
==========================================
- Hits 689 346 -343
+ Misses 13 4 -9
+ Partials 24 0 -24
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Is the maintenance burden justified, though? Also, if we were to migrate to something more native, I'd go for Rust and not C. |
I think I agree with you this time. I'm just a bit of a noob at PyO3 but maybe I'll look into trying it. |
|
Personally, I wouldn't want to maintain another thing in C. Especially since it's not as forward-compatible as Cython. |
Perhaps I could look into modifying the current cython code to have something simillar to what I have implemented here then. |
WARNING
__reduce__method for picklingWhat do these changes do?
This is another concept of moving something on over to C that I mentioned doing in the aiolibs matrix server to see if something could be optimized a bit more. These changes also include better documentation by throwing
the functions documented in the readthedocs into the C Module and Pure Python Module.
I have already spent about 12 hours all by hand in one day making this from my own inspiration from other things I've seen over the past couple of years, if this pr is turned down feel free to take what you want from it so that my work or ideas are at least being used elsewhere.
My main objective with this PR was to act as a better bridge between
FrozenList <-> listand removing all costly calls as well as better integration for atomic variables in C inspired by Python's new atomic variables.Are there changes in behavior for the user?
Related issue number
Checklist
CONTRIBUTORS.txtCHANGESfolder<issue_id>.<type>for example (588.bugfix)issue_idchange it to the pr id after creating the pr.feature: Signifying a new feature..bugfix: Signifying a bug fix..doc: Signifying a documentation improvement..removal: Signifying a deprecation or removal of public API..misc: A ticket has been closed, but it is not of interest to users.