[issue23266] Faster implementation to collapse non-consecutive ip-addresses

Serhiy Storchaka report at bugs.python.org
Sun Jan 18 22:53:12 CET 2015


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 <report at bugs.python.org>
<http://bugs.python.org/issue23266>
_______________________________________


More information about the Python-bugs-list mailing list