Skip to content

[PR #9204/34a626da backport][3.11] Significantly speed up filter_cookies#9244

Merged
bdraco merged 1 commit into
3.11from
patchback/backports/3.11/34a626dad03a013766c668a8db59d53c036177dd/pr-9204
Sep 22, 2024
Merged

[PR #9204/34a626da backport][3.11] Significantly speed up filter_cookies#9244
bdraco merged 1 commit into
3.11from
patchback/backports/3.11/34a626dad03a013766c668a8db59d53c036177dd/pr-9204

Conversation

@patchback

@patchback patchback Bot commented Sep 22, 2024

Copy link
Copy Markdown
Contributor

This is a backport of PR #9204 as merged into master (34a626d).

What do these changes do?

Significantly speed up filter_cookies by adding a cache for morsel construction. Previously every request had to create new Morsel objects. Its a common pattern to set a cookie once and read it many times. When testing with Home Assistant, the cache had nearly a 100% hit rate.

Benchmark #7790 (comment)

before
filter_domain: 6.765125583391637

after
filter_domain: 1.3521433752030134

Are there changes in behavior for the user?

no

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

no

@bdraco bdraco enabled auto-merge (squash) September 22, 2024 19:42
@codecov

codecov Bot commented Sep 22, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.79%. Comparing base (51870a9) to head (5e2e3da).
Report is 503 commits behind head on 3.11.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             3.11    #9244   +/-   ##
=======================================
  Coverage   97.79%   97.79%           
=======================================
  Files         108      108           
  Lines       34850    34859    +9     
  Branches     4152     4154    +2     
=======================================
+ Hits        34083    34092    +9     
  Misses        574      574           
  Partials      193      193           
Flag Coverage Δ
CI-GHA 97.69% <100.00%> (+<0.01%) ⬆️
OS-Linux 97.38% <100.00%> (+<0.01%) ⬆️
OS-Windows 94.93% <100.00%> (+<0.01%) ⬆️
OS-macOS 97.07% <100.00%> (+<0.01%) ⬆️
Py-3.10.11 97.16% <100.00%> (+<0.01%) ⬆️
Py-3.10.15 97.10% <100.00%> (+<0.01%) ⬆️
Py-3.11.10 97.00% <100.00%> (+<0.01%) ⬆️
Py-3.11.9 97.06% <100.00%> (+<0.01%) ⬆️
Py-3.12.6 97.42% <100.00%> (+<0.01%) ⬆️
Py-3.9.13 97.06% <100.00%> (+<0.01%) ⬆️
Py-3.9.20 97.01% <100.00%> (+<0.01%) ⬆️
Py-pypy7.3.16 96.60% <100.00%> (-0.01%) ⬇️
VM-macos 97.07% <100.00%> (+<0.01%) ⬆️
VM-ubuntu 97.38% <100.00%> (+<0.01%) ⬆️
VM-windows 94.93% <100.00%> (+<0.01%) ⬆️

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.

@bdraco bdraco merged commit 643369b into 3.11 Sep 22, 2024
@bdraco bdraco deleted the patchback/backports/3.11/34a626dad03a013766c668a8db59d53c036177dd/pr-9204 branch September 22, 2024 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant