Uh oh!
There was an error while loading. Please reload this page.
bpo-36904: new function _PyStack_DictAsVector - #13308
Conversation
jdemeyer
commented
May 14, 2019
|
jdemeyer
commented
May 14, 2019
I'm wondering whether we should use a special |
| return NULL; | ||
| } | ||
| /* Truncate the tuple to the desired length */ | ||
| Py_SIZE(kwtuple) = nkwargs; |
There was a problem hiding this comment.
That doesn't look safe at all. Won't such a tuple join the wrong freelist in tupledealloc?
jdemeyer
commented
May 17, 2019
I didn't think of the freelist but it's true that I already had bad feelings about messing with the tuple size like that. What do you think of my proposal (see above) of making a special |
encukou
commented
May 17, 2019
For a good answer I'd need to write the code :)
|
jdemeyer
commented
May 17, 2019
write the code or just see the code (written by me for example)?
This two-step process is going to take more work: it requires to discuss two API designs and implementations instead of one (with the first one going to be thrown away anyway once we do the second). So, I'd like to do it in one step if possible. |
jdemeyer
commented
May 17, 2019
On the other hand, adding the "refcount poking" part is pretty simple. So if you agree with doing just that manually (without changing |
encukou
commented
May 17, 2019
For a relatively complex optimization? benchmark the code, before and after.
But without the first, it'd be hard to argue that the tuple subclass actually brings any benefit. Tuple subclasses behave quite differently from exact tuples (they don't use freelists, for one).
Definitely! All I ask for before the optimization is a correct baseline. It might then very well turn out that the optimization is unnecessary. |
jdemeyer
commented
Jul 2, 2019
I decided to drop this idea. It's more controversial than I initially thought and I see why (I can't disagree). For reference: #14517 optimized |
Provide
_PyStack_DictAsVectoras safe and more efficient replacement for_PyStack_UnpackDict.https://bugs.python.org/issue36904
https://bugs.python.org/issue36907