feat: speed up adding and expiring records in the DNSCache by bdraco · Pull Request #1490 · python-zeroconf/python-zeroconf

@bdraco

Small performance improvement based on what was slow in the benchmark

  • adds: avoid creating an empty dict
  • expire: add some missing types to avoid some checks

@bdraco

@bdraco

@codecov

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.78%. Comparing base (854fef6) to head (e7efb1a).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1490   +/-   ##
=======================================
  Coverage   99.78%   99.78%           
=======================================
  Files          30       30           
  Lines        3311     3316    +5     
  Branches      453      455    +2     
=======================================
+ Hits         3304     3309    +5     
  Misses          5        5           
  Partials        2        2           

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

@codspeed-hq

CodSpeed Performance Report

Merging #1490 will improve performances by 8.19%

Comparing speed_up_adding_records_to_cache (e7efb1a) with master (854fef6)

Summary

⚡ 1 improvements
✅ 5 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
test_expire_no_records_to_expire 18.4 µs 17.1 µs +8.19%

@bdraco bdraco changed the title feat: speed up adding records to the DNSCache feat: speed up adding and expiring records in the DNSCache

Jan 22, 2025

@bdraco

@bdraco

@bdraco bdraco marked this pull request as ready for review

January 22, 2025 22:23

@bdraco bdraco deleted the speed_up_adding_records_to_cache branch

January 22, 2025 22:23