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

aio-libs / multidict / 38274499752
86%

Build:
DEFAULT BRANCH: master
Ran 12 Oct 2026 04:03PM UTC
Jobs 1
Files 50
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

12 Oct 2026 04:01PM UTC coverage: 85.863%. Remained the same
38274499752

push

github

web-flow
Grow and move the table to KIND_ANYSTR in one step before an add (#1785)

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

## What do these changes do?

An add used to check for room first, then `_md_store_new_entry()`
checked again whether the key fits a compact table and called
`md_to_anystr()` if not. Both checks are now one test on the add path,
and the rare work goes to a `COLD` `_md_prepare_add()`, which grows and
moves the table in a single `_md_rebuild_to_anystr()` when both are due.
`_md_store_new_entry()` no longer branches on the fit and cannot fail.

A side effect: the first plain `str` add to an empty `CIMultiDict` now
builds one `KIND_ANYSTR` table instead of a compact one that was copied
straight away (`empty_htkeys` is `KIND_ANYSTR`, so the old kind test
missed it).

`COLD` is needed: without it GCC inlined the slow path into
`md_add_with_hash_steal_refs()`, which then fell out of
`md_add_with_hash()` and `_md_extend_item()`, costing GIL `ctor_items`
+11% and `setitem_insert` +4%.

C extension only; the pure-Python backend has no table kinds.

## Are there changes in behavior for the user?

No.

## Is it a substantial burden for the maintainers to support this?

No; it removes a branch from the store helper and reuses an existing
rebuild.

## Related issue number

N/A

## Checklist

- [x] I think the code is well written
- [ ] Unit tests for the changes exist: N/A, internal refactor covered
by the existing suite
- [ ] Documentation reflects the changes: N/A
- [ ] If you provide code modification, please add yourself to
`CONTRIBUTORS.txt`: N/A
- [x] Add a new news fragment into the `CHANGES/` folder
- [x] `make doc-spelling` passes and any new technical words are added
to `docs/spelling_wordlist.txt`

Callgrind, 3.14.7, Ir per op, base `276c2cea` against this branch; rows
that moved by 0.5% or more:

| operation | GIL | FT |
|---|---|---|
| ctor / reinit, MultiDict | -1.1..-1.2% | -13.0..-14.4% |
| ctor / reinit, CIMultiDict | +1.0..+1.4% | -... (continued)

842 of 1684 branches covered (50.0%)

Branch coverage included in aggregate %.

9799 of 10709 relevant lines covered (91.5%)

1.83 hits per line

Jobs
ID Job ID Ran Files Coverage
1 MyPy - 38274499752.1 12 Oct 2026 04:03PM UTC 100
85.86
GitHub Action Run
Source Files on build 38274499752
  • Tree
  • List 50
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #38274499752
  • 2933772c on github
  • Prev Build on master (#38270578205)
  • Next Build on master (#38284156973)
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