Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid caching the constructed URL when altering the query string #1436

Merged
merged 3 commits into from
Nov 29, 2024

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Nov 29, 2024

When a query string is passed, the hit rate on the cache goes way down. Its best not to cache the query calls because the data is far more likely to change for query values.

This will show a reduction on the benchmark but its no different than it was before #1434

When a query string is passed, the hit rate on the cache
goes way down. Its best not to cache the query calls because
the data is far more likely to change for query values
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Nov 29, 2024
@bdraco bdraco mentioned this pull request Nov 29, 2024
Copy link

codspeed-hq bot commented Nov 29, 2024

CodSpeed Performance Report

Merging #1436 will degrade performances by 24.96%

Comparing disable_caching_building_query (b886ba5) with master (0d1c8b7)

Summary

❌ 5 (👁 5) regressions
✅ 80 untouched benchmarks

Benchmarks breakdown

Benchmark master disable_caching_building_query Change
👁 test_update_query_empty 65.4 µs 85.9 µs -23.81%
👁 test_update_query_none 61.7 µs 82.3 µs -24.96%
👁 test_url_extend_query_existing_query_string 126.4 µs 143 µs -11.6%
👁 test_with_query_empty 83.4 µs 104 µs -19.8%
👁 test_with_query_none 79.2 µs 100.2 µs -20.95%

Copy link

codecov bot commented Nov 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.11%. Comparing base (0d1c8b7) to head (b886ba5).
Report is 33 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1436   +/-   ##
=======================================
  Coverage   96.11%   96.11%           
=======================================
  Files          31       31           
  Lines        5873     5876    +3     
  Branches      349      349           
=======================================
+ Hits         5645     5648    +3     
  Misses        202      202           
  Partials       26       26           
Flag Coverage Δ
CI-GHA 96.11% <100.00%> (+<0.01%) ⬆️
MyPy 49.42% <100.00%> (+0.02%) ⬆️
OS-Linux 99.55% <100.00%> (ø)
OS-Windows 99.62% <100.00%> (ø)
OS-macOS 99.30% <100.00%> (ø)
Py-3.10.11 99.28% <100.00%> (ø)
Py-3.10.15 99.51% <100.00%> (ø)
Py-3.11.10 99.51% <100.00%> (ø)
Py-3.11.9 99.28% <100.00%> (ø)
Py-3.12.7 99.51% <100.00%> (ø)
Py-3.13.0 99.51% <100.00%> (ø)
Py-3.9.13 99.24% <100.00%> (ø)
Py-3.9.20 99.47% <100.00%> (ø)
Py-pypy7.3.16 99.53% <100.00%> (ø)
Py-pypy7.3.17 99.55% <100.00%> (ø)
VM-macos-latest 99.30% <100.00%> (ø)
VM-ubuntu-latest 99.55% <100.00%> (ø)
VM-windows-latest 99.62% <100.00%> (ø)
pytest 99.55% <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.

@bdraco
Copy link
Member Author

bdraco commented Nov 29, 2024

CacheInfo(hits=771, misses=132, maxsize=128, currsize=128)

Once its primed the miss rate barely increases now.

@bdraco bdraco marked this pull request as ready for review November 29, 2024 20:05
@bdraco bdraco merged commit e9cae46 into master Nov 29, 2024
46 of 48 checks passed
@bdraco bdraco deleted the disable_caching_building_query branch November 29, 2024 20:05
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