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

jstasiak / python-zeroconf / 561 / 3
94%
master: 94%

Build:
DEFAULT BRANCH: master
Ran 07 Mar 2020 09:34PM UTC
Files 2
Run time 0s
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

07 Mar 2020 09:32PM UTC coverage: 93.567% (-0.09%) from 93.656%
561.3

push

travis-ci

jstasiak
Optimize handle_response cache check

The handle_response loop would encounter a unique record
it would search the cache in order to remove keys that
matched the DNSEntry for the record.

Since the cache is stored as a list of records with the key as the record name,
 we can avoid searching the entire cache each time and on
search for the DNSEntry of the record. In practice this means
with 5000 entries and records in the cache we now only need to search
4 or 5.

When looping over the cache entries for the name, we now check the expire time
first as its cheaper than calling DNSEntry.__eq__

Test environment:

  Home Assistant running on home networking with a /22
  and a significant amount of broadcast traffic

  Testing was done with py-spy v0.3.3
    (https://github.com/benfred/py-spy/releases)

  # py-spy top --pid <pid>

Before:
```
Collecting samples from '/usr/local/bin/python3 -m homeassistant --config /config' (python v3.7.6)
Total Samples 10200
GIL: 0.00%, Active: 0.00%, Threads: 35

  %Own   %Total  OwnTime  TotalTime  Function (filename:line)
  0.00%   0.00%   18.13s    18.13s   _worker (concurrent/futures/thread.py:78)
  0.00%   0.00%    2.51s     2.56s   run (zeroconf/__init__.py:1221)
  0.00%   0.00%   0.420s    0.420s   __eq__ (zeroconf/__init__.py:394)
  0.00%   0.00%   0.390s    0.390s   handle_read (zeroconf/__init__.py:1260)
  0.00%   0.00%   0.240s    0.670s   handle_response (zeroconf/__init__.py:2452)
  0.00%   0.00%   0.230s    0.230s   __eq__ (zeroconf/__init__.py:606)
  0.00%   0.00%   0.200s    0.810s   handle_response (zeroconf/__init__.py:2449)
  0.00%   0.00%   0.140s    0.150s   __eq__ (zeroconf/__init__.py:632)
  0.00%   0.00%   0.130s    0.130s   entries (zeroconf/__init__.py:1185)
  0.00%   0.00%   0.090s    0.090s   notify (threading.py:352)
  0.00%   0.00%   0.080s    0.080s   read_utf (zeroconf/__init__.py:818)
  0.00%   0.00%   0.080s    0.080s   __eq__ (zeroconf/__init__.py:678)
  0.00%   0.00%   0.070s    0.080s  ... (continued)

2109 of 2254 relevant lines covered (93.57%)

0.94 hits per line

Source Files on job 561.3
  • Tree
  • List 0
  • Changed 2
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 439
  • Travis Job 561.3
  • 37fa0a0d on github
  • Prev Job for on master (#551.3)
  • Next Job for on master (#566.2)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc