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

aio-libs / multidict / 36348057864
86%

Build:
DEFAULT BRANCH: master
Ran 27 Sep 2026 08:27PM UTC
Jobs 1
Files 45
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

27 Sep 2026 08:26PM UTC coverage: 87.258% (+0.04%) from 87.217%
36348057864

push

github

web-flow
Resize a full table by its live entries, never compact in place (#1615)

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

## What do these changes do?

When an add finds the table full, the C extension compacted it in place
at the same size whenever it held deleted entries. That regains only as
many slots as were deleted, so a table filled exactly to its usable size
and then churned with `del d[oldest]; d.add(new)` was rebuilt on every
add. With 87381 items, 5000 such steps took 4.5 s against 2 ms at 88000
items.

The rebuild is now sized by `GROWTH_RATE` (three times the live entries)
alone, which is the rule CPython and the pure-Python backend already
use; live entries decide whether the table compacts at the same size,
grows or shrinks. `_md_shrink()` and the GIL-only in-place
`_md_shrink_impl()` are removed, and `_md_resize()` is renamed
`_md_rebuild()` as the single rebuild primitive. The pure-Python backend
already behaved this way and is unchanged.

## Are there changes in behavior for the user?

Yes: the delete-then-add churn on a full table is O(1) amortized again,
and a C table shrinks when adds resume after many deletions, matching
the pure-Python backend.

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

No; it removes a code path and the GIL/FT difference in shrinking.

## Related issue number

N/A

## Checklist

- [x] I think the code is well written
- [x] Unit tests for the changes exist
- [ ] 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`

Drafted with Claude Opus 5.5 (Claude Code); reviewed by @asvetlov.

<details>
<summary>Agent run details (optional, for reviewers)</summary>

Churn timing (GIL, 5000 `del` + `add` steps, fresh table of n items):

| n | before | after |
|---|---|---|
| ... (continued)

781 of 1562 branches covered (50.0%)

Branch coverage included in aggregate %.

34 of 34 new or added lines in 1 file covered. (100.0%)

8464 of 9033 relevant lines covered (93.7%)

1.87 hits per line

Jobs
ID Job ID Ran Files Coverage
1 MyPy - 36348057864.1 27 Sep 2026 08:27PM UTC 90
87.26
GitHub Action Run
Source Files on build 36348057864
  • Tree
  • List 45
  • Changed 5
  • Source Changed 3
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #36348057864
  • fd450c14 on github
  • Prev Build on master (#36342961613)
  • Next Build on master (#36350699863)
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