-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Improve performance of list and tuple repeat methods #91247
Comments
The special case of a repeat with n=1 does not use memcpy. An implementation with it showed no performance improvement. |
After rebasing to main and compiling with optimizations enabled, there are some new performance results. There are two PRs improving the performance, in particular for the case of a small list (e.g. 2 to 10 elements) and a large number of repeats.
Pyperformance results show no improvements, microbenchmarks do, details in the next post. Pyperformance results: main against #91482Note: some benchmarks are missing as they fail on the test system
Pyperformance results: main against #32045Note: some benchmarks are missing as they fail on the test system
|
A microbenchmark with a wide range of tests shows a performance improvement of about 12%, with some benchmarks improving much more.
Results for #91247 (has specializations)
Results for #32045 (no specializations)
|
More microbenchmarks showing strange speedup:
Results (main against #91247)
For Main
PR
Maybe the performance in main is not so good for |
@thatbirdguythatuknownot Could you run the benchmark from #91247 (comment) on your system? |
Gonna test it out. |
@eendebakpt Do I do it like this?
|
@thatbirdguythatuknownot That was indeed what I meant. That was with your branch #92286? The results vary quite a lot, some make sense, others not (yet):
In any case both #91482 and your #92286 seem like an improvement over current main. @MojoVampire Could you review #91482? And perhaps comment on the performance benchmarks. They consistently show an overall improvement, but also some fluctuations what might be system/compiler dependent. |
@eendebakpt I actually used a copy of #91247 to test it out. Was I supposed to do that with #92286? |
Keeping the |
@thatbirdguythatuknownot #91247 is the issue, I guess you tested either # 91482 (specializations) or # 32045 (no specializations). The fact that both the PRs have gh-91247 in the name makes it a bit confusing. Note that also |
I tested #32045. |
* Add _Py_memory_repeat function to pycore_list * Add _Py_RefcntAdd function to pycore_object * Use the new functions in tuplerepeat, list_repeat, and list_inplace_repeat
Thanks, @eendebakpt! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: