gh-91247: improve performance of list and tuple repeat#32045
Closed
eendebakpt wants to merge 13 commits intopython:mainfrom
Closed
gh-91247: improve performance of list and tuple repeat#32045eendebakpt wants to merge 13 commits intopython:mainfrom
eendebakpt wants to merge 13 commits intopython:mainfrom
Conversation
64f74f8 to
109526a
Compare
Contributor
Author
|
Microbenchmark (main against commit Code for benchmark``` import pyperf runner = pyperf.Runner()setup='a=[1,2,3]; a1=[1,]; t=(1,2,3,4)' for n in [1,2,10,1000]: runner.timeit(name=f"[control] list pop+append", |
This was referenced Apr 12, 2022
MaxwellDupre
approved these changes
Apr 28, 2022
Contributor
MaxwellDupre
left a comment
There was a problem hiding this comment.
414 tests OK.
1 test failed:
test_embed
I don't think this is related, hence with most test passing looks ok.
Contributor
Author
|
@MaxwellDupre Thanks for the approval. Note that this PR was marked draft. There are two PRs to resolve #91247, this one and #91482. I have a small preference for #91482 (but this PR is also an improvement) |
Contributor
Author
|
Closing as #91482 seems a better approach |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improve the performance of the list repeat methods by reducing the number of reference count operations and copying data using
memcpy. The approach to reduce the number ofmemcpyinvocations is similar to #31999, but due to the handling of reference counts in thelistandtuplerepeat methods the code is slightly different.Note: the specialization for the case of 1 item in a
listortuplecan be removed with (almost) no loss of performance. More details and a comparison against the version with specializations (#91482) are the issue #91247.https://bugs.python.org/issue47091