Skip to content

Commit 9d3c53f

Browse files
authored
Replace pair_list with hash table (#1128)
1 parent bdbbc48 commit 9d3c53f

File tree

16 files changed

+3421
-2218
lines changed

16 files changed

+3421
-2218
lines changed

.codecov.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ coverage:
1818
status:
1919
patch:
2020
runtime:
21-
target: 100%
21+
target: 95%
2222
flags:
2323
- pytest
2424
typing:
@@ -30,7 +30,7 @@ coverage:
3030
- pytest
3131
paths:
3232
- multidict/
33-
target: 100%
33+
target: 95%
3434
tests:
3535
flags:
3636
- pytest

CHANGES/1128.feature

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Replace internal implementation from an array of items to hash table.
2+
algorithmic complexity for lookups is switched from O(N) to O(1).
3+
4+
The hash table is very similar to :class:`dict` from CPython but it allows keys duplication.
5+
6+
The benchmark shows 25-50% boost for single lookups, x2-x3 for bulk updates, and x20 for
7+
some multidict view operations. The gain is not for free:
8+
:class:`~multidict.MultiDict.add` and :class:`~multidict.MultiDict.extend` are 25-50%
9+
slower now. We consider it as acceptable because the lookup is much more common
10+
operation that addition for the library domain.

0 commit comments

Comments
 (0)