Skip to content

Remove the last element by popitem()#1105

Merged
asvetlov merged 4 commits intomasterfrom
popitem
Mar 25, 2025
Merged

Remove the last element by popitem()#1105
asvetlov merged 4 commits intomasterfrom
popitem

Conversation

@asvetlov
Copy link
Copy Markdown
Member

It gives O(1) amortized complexity.

The standard dict.popitem() removes the last entry also.

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided There is a change note present in this PR label Mar 25, 2025
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Mar 25, 2025

CodSpeed Performance Report

Merging #1105 will improve performances by 12.35%

Comparing popitem (1366040) with master (6097b60)

Summary

⚡ 2 improvements
✅ 140 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
test_multidict_popitem_str[case-insensitive-c-extension-module] 79.4 µs 71 µs +11.87%
test_multidict_popitem_str[case-sensitive-c-extension-module] 71 µs 63.2 µs +12.35%

@asvetlov asvetlov marked this pull request as ready for review March 25, 2025 17:40
@asvetlov asvetlov enabled auto-merge (squash) March 25, 2025 17:40
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 25, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.86%. Comparing base (6097b60) to head (1366040).
Report is 63 commits behind head on master.

Files with missing lines Patch % Lines
multidict/_multidict_py.py 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1105   +/-   ##
=======================================
  Coverage   92.86%   92.86%           
=======================================
  Files          44       44           
  Lines        5088     5088           
  Branches      385      385           
=======================================
  Hits         4725     4725           
  Misses         95       95           
  Partials      268      268           
Flag Coverage Δ
CI-GHA 92.86% <80.00%> (ø)
MyPy 86.57% <80.00%> (ø)
pytest 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@asvetlov asvetlov merged commit 10a97e1 into master Mar 25, 2025
45 of 46 checks passed
@asvetlov asvetlov deleted the popitem branch March 25, 2025 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant