Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue21487

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Assorted ipaddress performance improvements
Type:performanceStage:resolved
Components:Library (Lib)Versions:Python 3.5
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: ncoghlan, pitrou, pmoody, python-dev, serhiy.storchaka
Priority:normalKeywords:patch

Created on2014-05-12 20:04 bypitrou, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
ipaddr_perf.patchpitrou,2014-05-12 20:04review
ipaddr_perf2.patchpitrou,2014-05-14 13:04review
Messages (6)
msg218357 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)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)*(Python committer)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)*(Python committer)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)*(Python committer)Date: 2014-05-14 19:38
Looks as second alternative is few percents faster then first one.
msg218607 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)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)(Python triager)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
DateUserActionArgs
2022-04-11 14:58:03adminsetgithub: 65686
2014-05-15 19:05:59pitrousetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2014-05-15 18:21:57python-devsetnosy: +python-dev
messages: +msg218622
2014-05-15 12:35:56pitrousetmessages: +msg218607
2014-05-14 19:38:11serhiy.storchakasetmessages: +msg218568
2014-05-14 13:04:09pitrousetfiles: +ipaddr_perf2.patch

messages: +msg218525
2014-05-14 10:17:17serhiy.storchakasetnosy: +serhiy.storchaka
messages: +msg218515
2014-05-12 20:04:23pitroucreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp