Skip to content

Commit

Permalink
Simplify read_name
Browse files Browse the repository at this point in the history
(venv) root@ha-dev:~/python-zeroconf# python3 -m timeit -s 'result=""' -u usec 'result = "".join((result, "thisisaname" + "."))'
20000 loops, best of 5: 16.4 usec per loop
(venv) root@ha-dev:~/python-zeroconf# python3 -m timeit -s 'result=""' -u usec 'result += "thisisaname" + "."'
2000000 loops, best of 5: 0.105 usec per loop
  • Loading branch information
bdraco authored and jstasiak committed Feb 4, 2021
1 parent c5a675d commit 5e268fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zeroconf/__init__.py
Expand Up @@ -880,7 +880,7 @@ def read_name(self) -> str:
break
t = length & 0xC0
if t == 0x00:
result = ''.join((result, self.read_utf(off, length) + '.'))
result += self.read_utf(off, length) + '.'
off += length
elif t == 0xC0:
if next_ < 0:
Expand Down

0 comments on commit 5e268fa

Please sign in to comment.