Conversation
CodSpeed Performance ReportMerging #1125 will not alter performanceComparing Summary
|
|
Okay, module state finding is not for free. |
|
performance is good again after adding a pointer to the module state to pair_list_t |
|
|
Yeah, tp_init has no direct access to the module state and should do a lookup over the class's hierarchy. |
|
Testing
|
|
@bdraco for yarl/aiohttp needs, I could imagine exposing public C API for use from Cython. Another thing that definitely could improve the performance is switching from pair_list_t to hashtable. It should be pretty close to the structure used for cpython dict itself with the following changes:
I'd like to experiment with hashtable, O(N) vs O(1) for lookup operations looks interesting. |
These areas are warm and I see them in production profiles. I'm not sure if they could benefit from a C API https://github.com/aio-libs/aiohttp/blob/eff1dd754c526aae967fe80075aca1df4c28666b/aiohttp/payload.py#L167 Might be enough to implement the above patterns as multidict functions but with the flexibility of
O(N) sounds really nice. I'm guessing this probably makes more difference than a C API |
|
Please keep the PR open for a while, I'd like to apply minor improvements. |
bdraco
left a comment
There was a problem hiding this comment.
Looked over the code. LGTM. I don't have my head fully wrapped around the Py_TPFLAGS_MANAGED_WEAKREF but it looks good AFAICT.
Testing went well. No regressions or obvious performance issues observed
|
Near midnight for me (UTC-10) so off to bed. Let me know if anything should be retested on prod and I'm happy to give it a spin tomorrow when I get up |
|
auto-headers processing needs #292 implemented for good performance. |
|
@bdraco |
Yeah. I explored it a bit in aio-libs/aiohttp#10696 and it doesn't seem like there is much to gain there. Maybe some potential saving on iterating but even than usually its two or three keys being iterated. |
The PR eliminates global variables except for constant module definitions as a side effect.