Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-72793: C implementation of parts of copy.deepcopy#91610
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:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Conversation
eendebakpt commented Apr 16, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
eendebakpt commented Apr 28, 2022
@pablogsal Would you be able to review this PR? |
eendebakpt commented May 27, 2022
@serhiy-storchaka As the latest core develop working on this file, would you be able to review this PR? |
83741a6 to 2f8e489Compareaf2a201 to 502c747Compare
AA-Turner 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.
I don't feel comfortable reviewing the C code, but you will need to add tests to ensure the fallback and C implementation have the same inputs/outputs/etc -- the easiest way would be to duplicate the tests and run one set for the C accelerator and one for the Python version.
A
Misc/NEWS.d/next/Core and Builtins/2022-04-16-20-21-13.gh-issue-72793.qc-BP-.rst Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
2c18cb6 to c0fd5c9Compareeendebakpt commented Jun 8, 2022
@AA-Turner The Note: in earlier versions of the PR the fallback there was a funny |
AA-Turner commented Jun 8, 2022
If both functions exist and can be theoretically used, both must be tested. You can A |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bedevere-bot commented Jun 8, 2022
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
serhiy-storchaka commented Jun 8, 2022
There are some issues with the |
eendebakpt commented Jun 8, 2022
@tiran noted the fallback will be used by PyPy, so it must indeed be tested. I will add the required tests |
tiran commented Jun 8, 2022
We have helper code to block / force imports to test both pure and C accelerated features. |
eendebakpt commented Jun 8, 2022
I addressed some of the review comments. @serhiy-storchaka Could you indicate which issues with the |
erlend-aasland commented Oct 4, 2023
FYI, |
eendebakpt commented Oct 4, 2023
Will look at later this week |
eendebakpt commented Oct 4, 2023
@erlend-aasland The failing tests where due to the recent addition of The PR is ready for review, although I am not sure the item Serhiy raised should be resolved first. See #103035 (comment) and #109498. |
erlend-aasland commented Oct 5, 2023
I'll leave that to @serhiy-storchaka. |
Christian is inactive at the moment, so dismissing his review.
eendebakpt commented Apr 4, 2024
For any reviewers: I also created a performance improvement for the python implementation: #114266. Depending on the outcome of that PR and some (minor) changes I want to do to make this work in free-threading I will update the benchmarks. |
erlend-aasland commented Apr 4, 2024
@eendebakpt, also consider adapting to free-threading in a follow-up PR; this PR is already a huge diff. |
ghost commented Jun 9, 2024 • edited by ghost
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by ghost
Uh oh!
There was an error while loading. Please reload this page.
The following commit authors need to sign the Contributor License Agreement: |
eendebakpt commented Jun 9, 2024
Update of the benchmarks with recent changes to main: |
eendebakpt commented Jun 28, 2024
To make a fair comparison between current main and the C implementation in this PR I looked at the python implementation again to see whether there are optimizations we do in the C implementation that could also be applied in the Python main. There are quite some options:
I will not make PRs for these, because each of them has a very high likelihood of being rejected because either the performance gain is small or the change would reduce readability or maintainability of the code (for the interested reader: I would give the last option the highest probability of success). |
The original idea and implementation are from @Villemoes. The original issue has been inactive for a long time.
Benchmark on deepcopy of a
dictanddataclass:Updated benchmark: (23-12-2022, main at 1ecfd1e)
Updated benchmark: (16-9-2023, main at e57ecf6)
Updated benchmark (10-01-2024)
Benchmark details
Test script
Updated test script
Old test script:
Fixes#72793
Pyperformance results
Pyperformance results show small speedup, although this could very well be a random fluctuation. (there are no explicit calls to deepcopy in the pyperformance tests)
Notes
copy.deepcopy(see https://peps.python.org/pep-0399/). In the CI we test both the pure python and accelerator version ofdeepcopy.