• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aio-libs / multidict / 36992438938
86%

Build:
DEFAULT BRANCH: master
Ran 02 Oct 2026 09:55AM UTC
Jobs 1
Files 49
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

02 Oct 2026 09:54AM UTC coverage: 86.027% (-0.6%) from 86.621%
36992438938

push

github

web-flow
Store a CIMultiDict of exact istr keys in the compact table (#1648)

<!-- Thank you for your contribution! -->

## What do these changes do?

A `CIMultiDict` whose keys are all exact `istr` now uses the 16-byte
compact entry that #1644 introduced for a `MultiDict` of exact `str`
keys. The identity is the key's canonical form, read through the `istr`,
so the entry keeps only the key and the value. Any other key moves the
table to the full layout, keeping every index; the constructor picks the
layout from the first key it will get, or the full one when it also gets
keyword arguments, whose names are plain `str`, and `clear()` lets the
table start compact again. `extend()`, `update()` and `merge()` with
keyword arguments move a compact table while reserving room for the
batch, in one rebuild.

To keep `MultiDict` and str-keyed `CIMultiDict` flat while the table can
now take either layout under a `CIMultiDict`, every hot entry point
knows its class at compile time: `CIMultiDict` and `CIMultiDictProxy`
got their own slots and method tables, the bulk
`extend()`/`update()`/`merge()` paths are compiled once per class, and
the shared helpers take `ci` as a constant (asserted against `md->is_ci`
in debug builds). Lookups also stopped taking a reference to the
identity of an exact `str` or `istr` key; any other key is handled out
of line. `tools/check_inlining.py` gained rules for the new pins.

For an `istr`-keyed `CIMultiDict` of 200 keys the table is 45% smaller
(12032 to 6576 bytes), `copy()` costs 55 to 58% fewer instructions and
construction 14% (GIL) to 17% (FT) fewer. `d[key]` and `key in d` got 2
to 10% cheaper on GIL and 12 to 20% on FT for both classes. Rows that
got slower are listed below; the largest is `getitem_istr` on a
`MultiDict` (+4.8% on GIL), an `istr` key in a case-sensitive mapping,
which now takes the out-of-line path.

## Are there changes in behavior for the user?

No, apart from a smaller `__sizeof__()` for an `istr`-keyed
`CIMultiDic... (continued)

791 of 1582 branches covered (50.0%)

Branch coverage included in aggregate %.

62 of 149 new or added lines in 2 files covered. (41.61%)

9127 of 9947 relevant lines covered (91.76%)

1.84 hits per line

Uncovered Changes

Lines Coverage ∆ File
87
40.66
-5.34% tests/test_table_kinds.py
Jobs
ID Job ID Ran Files Coverage
1 MyPy - 36992438938.1 02 Oct 2026 09:55AM UTC 98
86.03
GitHub Action Run
Source Files on build 36992438938
  • Tree
  • List 49
  • Changed 4
  • Source Changed 2
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #36992438938
  • 3d04173b on github
  • Prev Build on master (#36880457231)
  • Next Build on master (#37005918410)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc