
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2014-05-12 20:04 bypitrou, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| ipaddr_perf.patch | pitrou,2014-05-12 20:04 | review | ||
| ipaddr_perf2.patch | pitrou,2014-05-14 13:04 | review | ||
| Messages (6) | |||
|---|---|---|---|
| msg218357 -(view) | Author: Antoine Pitrou (pitrou)*![]() | Date: 2014-05-12 20:04 | |
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. | |||
| msg218515 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2014-05-14 10:17 | |
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()ordef _count_righthand_zero_bits(number, bits): if not number: return bits return (~(number | -number)).bit_length() | |||
| msg218525 -(view) | Author: Antoine Pitrou (pitrou)*![]() | Date: 2014-05-14 13:04 | |
Good point, this is a much faster implementation. Updated patch (and fixed the implementation to not return more than `bits`). | |||
| msg218568 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2014-05-14 19:38 | |
Looks as second alternative is few percents faster then first one. | |||
| msg218607 -(view) | Author: Antoine Pitrou (pitrou)*![]() | Date: 2014-05-15 12:35 | |
I find logical operations on negative numbers confusing in Python, so I'd rather stick with the first implementation. | |||
| msg218622 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2014-05-15 18:21 | |
New changeset2711677cf874 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 | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:03 | admin | set | github: 65686 |
| 2014-05-15 19:05:59 | pitrou | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2014-05-15 18:21:57 | python-dev | set | nosy: +python-dev messages: +msg218622 |
| 2014-05-15 12:35:56 | pitrou | set | messages: +msg218607 |
| 2014-05-14 19:38:11 | serhiy.storchaka | set | messages: +msg218568 |
| 2014-05-14 13:04:09 | pitrou | set | files: +ipaddr_perf2.patch messages: +msg218525 |
| 2014-05-14 10:17:17 | serhiy.storchaka | set | nosy: +serhiy.storchaka messages: +msg218515 |
| 2014-05-12 20:04:23 | pitrou | create | |