Repository navigation
Add getall benchmarks for keys with many values - #1509
Merged
Merged
Conversation
asvetlov
marked this pull request as ready for review
September 21, 2026 18:33
Contributor
|
Merging this PR will not alter performance
Performance Changes
Comparing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1509 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 37 37
Lines 6204 6227 +23
Branches 560 565 +5
=========================================
+ Hits 6204 6227 +23
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What do these changes do?
Adds three CodSpeed benchmarks for
getall()on keys with many values, to give #1505 a baseline on paths the current benchmarks miss.After #1505,
getall()keeps up to 8 matches in a short inline list and only then starts a bitmap, which lives in a 4 KB inline buffer (32768 entries) and moves to the heap for bigger tables. The existingtest_multidict_getall_str_hit_large_tablehas 8 values per key, so it no longer reaches the bitmap at all.test_multidict_getall_str_hit_large_table_many_values: 16 values per key over 4096 keys (65536 entries), 128 lookups per run; covers the heap bitmap.test_multidict_getall_str_hit_many_values: 64 values per key over 16 keys (1024 entries), each key looked up 8 times per run; covers the inline bitmap.test_cimultidict_getall_istr_hit_many_values: theCIMultiDict/istrtwin of the previous one.Are there changes in behavior for the user?
No, benchmarks only.
Is it a substantial burden for the maintainers to support this?
No.
Related issue number
Related to #1505
Checklist
CONTRIBUTORS.txt: N/ACHANGES/foldermake doc-spellingpasses and any new technical words are added todocs/spelling_wordlist.txtAgent run details (optional, for reviewers)
Isolated venv on CPython 3.13.2, based on upstream/master 1ccffea.
C extension:
pytest tests/test_multidict_benchmarks.py -q: 197 passed.Pure Python (
MULTIDICT_NO_EXTENSIONS=1,--no-c-extensions): 100 passed, including all new cases.pre-commit runon changed files: passed.make doc-spelling: build succeeded.Drafted with Claude Code (Claude Opus 5); reviewed by @asvetlov.