-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
Properly support set operations for case insensitive multidict views #1038
Conversation
CodSpeed Performance ReportMerging #1038 will degrade performances by 76.89%Comparing Summary
Benchmarks breakdown
|
Codecov ReportAttention: Patch coverage is
❌ Your project status has failed because the head coverage (83.36%) is below the target coverage (85.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #1038 +/- ##
==========================================
- Coverage 93.19% 91.15% -2.04%
==========================================
Files 44 42 -2
Lines 5378 6060 +682
Branches 402 613 +211
==========================================
+ Hits 5012 5524 +512
- Misses 95 105 +10
- Partials 271 431 +160
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@asvetlov Please double check my last commit. That fixes the type errors. |
Pick up unacknowledged events
pure-python code is done and 100% covered by tests. |
C implementation for KeysView is ready. |
Hmm, the implementation is slightly incorrect, it always should prefer overlapping keys from the left operand. |
Now Python impl and tests are good. |
Are you sure about that? I think we discussed this before somewhere, and I suggested as a developer that if you are intersecting with e.g. I can imagine code like this:
I don't think think the order should matter here, it should always produce a result from the user's set. If it produces |
The above could also be safer if we had a CISet that was returned in this case and made the equality comparison safer regardless. But, that might be overkill to create a whole new set class. |
I really don't want to rely on this subtle logic. It is better to establish that the left argument controls that keys are used if they are present in both left and right arguments. If multidict operators are called, they make sure that the comparison is performed on identities, it works well with case insensitivity. But the type is established by the left arg. |
@Dreamsorcerer another point is |
Well, that's because the right side is never expected to have anything returned. I still think the |
I had both variants implemented, and I've found that the PR's version is less controversial (but neither is 100% perfect, sure). |
Regarding performance, I honestly don't care about the |
XOR is going to be a rare enough operation that I don't think its a problem. The speed up to the OR and AND operations are likely going to outweigh any loss to XOR performance for most cases. |
Let's make an agreement that the performance of the items view is not very important (while it could be improved, sure). |
I looked though aiohttp and I didn't find any of these type of operations in aiohttp hot paths so I think its fine. The other changes you made in the past few days are likely to be much more impactful in improving performance. Let's merge this, and I can do a new release of multidict later today, update it in aiohttp and we can get a better idea of what the performance impacts are. Benchmarks in aio-libs/aiohttp#10654 If I'm wrong and we have these operations somewhere in an aiohttp hot path, we can revisit. I don't think thats the case however. |
Looks like there is a regression in the pure-python version #1111 |
Looks like a minor performance regression in yarl aio-libs/yarl#1490 but not specific to this PR |
tests in #1112 |
For #965