-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
remove free_list for bound method objects #81521
Comments
LOAD_METHOD avoids temporary bound method object. Now I think there is not enough performance benefit from free_list. This is performance diff of removing free_list (with LTO, without PGO, patched=removed free_list):
I think free_list is useful only when several benchmarks in pyperformance shows more than 5% speedup. FWIW, In case of sqlite_synth, I think performance difference came from here: cpython/Modules/_sqlite/connection.c Line 662 in 0150001
If performance of user-defined aggregate feature is really important, we can optimize it further. |
PyCFunction has similar free_list. |
Good idea. bpo-37337 removes many calls of _PyObject_CallMethodId() which does NOT use the LOAD_METHOD optimization. |
#58440 uses only one free object instead of at most 256 free list. |
That sounds like a compromise which is worse than either extreme: it's worse than no free list because you still have the overhead of dealing with the one object. And it's worse than a free list of 256 because it won't for nested calls. |
Are the benchmark results that you posted above for removing the free list completely or for the one-element free list as in PR 14232? |
Sorry, I just pushed another idea before I leave my office. |
Yes. I see +3% overhead in several benchmarks and I want to see how one free obj save them.
Yes. But it still helps some common simple cases.
256 free list may bother 256 pools are reused. But one free obj keeps only one pool. And we can remove the overhead of linked list too. Of course, I prefer a simple code. But let's wait for benchmark result. |
Latest benchmark:
I decided to just remove the free_list. |
This caused a performance regression (70%) for a fundamental operation. See bpo-37340. Sometimes, bound methods are used directly and not through LOAD_METHOD: sorted(data, key=str.upper) |
Which issue? This is bpo-37340. |
Oh, I guess that it's bpo-39117. |
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: