[issue21487] Assorted ipaddress performance improvements

2014-05-15 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue21487] Assorted ipaddress performance improvements

2014-05-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset 2711677cf874 by Antoine Pitrou in branch 'default': Issue #21487: Optimize ipaddress.summarize_address_range() and ipaddress.{IPv4Network,IPv6Network}.subnets(). http://hg.python.org/cpython/rev/2711677cf874 -- nosy: +python-dev __

[issue21487] Assorted ipaddress performance improvements

2014-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: I find logical operations on negative numbers confusing in Python, so I'd rather stick with the first implementation. -- ___ Python tracker ___

[issue21487] Assorted ipaddress performance improvements

2014-05-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Looks as second alternative is few percents faster then first one. -- ___ Python tracker ___ ___ P

[issue21487] Assorted ipaddress performance improvements

2014-05-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: Good point, this is a much faster implementation. Updated patch (and fixed the implementation to not return more than `bits`). -- Added file: http://bugs.python.org/file35251/ipaddr_perf2.patch ___ Python tracker

[issue21487] Assorted ipaddress performance improvements

2014-05-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Alternative implementations of _count_righthand_zero_bits(): def _count_righthand_zero_bits(number, bits): if not number: return bits return (~number & (number-1)).bit_length() or def _count_righthand_zero_bits(number, bits): if not numbe

[issue21487] Assorted ipaddress performance improvements

2014-05-12 Thread Antoine Pitrou
New submission from Antoine Pitrou: Now that issue #16531 has been committed, it becomes possible to make some operations faster. Attached patch makes summarize_address_range() ~2x faster and Network.subnets() ~4x faster. -- components: Library (Lib) files: ipaddr_perf.patch keywords: