[issue23266] Faster implementation to collapse non-consecutive ip-addresses
Markus
report at bugs.python.org
Tue Jan 20 20:03:10 CET 2015
Markus added the comment:
My initial patch was wrong wrt. _find_address_range.
It did not loop over equal addresses.
Thats why performance with many equal addresses was degraded when dropping the set().
Here is a patch to fix _find_address_range, drop the set, and improve performance again.
python3 -m timeit -s "import bipaddress; ips = [bipaddress.ip_address('2001:db8::1000') for i in range(1000)]" -- "bipaddress.collapse_addresses(ips)"
1000 loops, best of 3: 1.76 msec per loop
python3 -m timeit -s "import aipaddress; ips = [aipaddress.ip_address('2001:db8::1000') for i in range(1000)]" -- "aipaddress.collapse_addresses(ips)"
1000 loops, best of 3: 1.32 msec per loop
----------
Added file: http://bugs.python.org/file37794/ipaddress_faster_collapse4.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23266>
_______________________________________
More information about the Python-bugs-list
mailing list