-
-
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
Replace pair_list with hash table #1128
base: master
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #1128 will degrade performances by 31.97%Comparing Summary
Benchmarks breakdown
|
Heh. Appending new values to the multidict is more expensive, all other ops are faster. We have a tradeoff, as usual. I think that the lookup is a much more often operation than the multidict filling. |
The PR is more-or-less done but I'd like to make some polishing and self-review later. Careful testing is appreciated! New multidict is close to Python's dict except for multiple keys, of course. It starts from the empty hashtable, which grows by a power of 2 starting from 8: 8, 16, 32, 64, 128, ... The table is resized if needed, and bulk updates ( Item deletion puts DKIX_DUMMY special index in the hashtable. In opposite to the standard The iteration for operations like
The performance is okay, multidict creation is slightly slower because the hashtable should be recalculated and the indices table rebuilds, but all other operations are faster. Multidict is still slightly slower than the regular dict because I don't want to use the private API for accessing internal Python structures, the most notable is the string's hash. TODO:
Open question: Should we use If anybody wants to play with the code, two things could help debugging.
Please feel free to experiment with and ask any questions. |
No description provided.