Serhiy Storchaka added the comment:

Deduplication should not be omitted. This slowed down collapsing of duplicated 
addresses.

$ ./python -m timeit -s "import ipaddress; ips = 
[ipaddress.ip_address('2001:db8::1000') for i in range(1000)]" -- 
"ipaddress.collapse_addresses(ips)"

Before f7508a176a09:
100 loops, best of 3: 13.4 msec per loop

After f7508a176a09:
10 loops, best of 3: 129 msec per loop

Proposed patch restores performance for duplicated addresses and simplifies the 
code using generators.

----------
nosy: +serhiy.storchaka
resolution: fixed -> 
stage: resolved -> patch review
status: closed -> open
Added file: http://bugs.python.org/file37768/ipaddress_faster_collapse3.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23266>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to