[issue21513] speed up some ipaddress properties

Antoine Pitrou report at bugs.python.org
Thu May 15 23:24:38 CEST 2014


New submission from Antoine Pitrou:

Some properties on IPv4Address and IPv6Address instantiate one or several network objects each time they are computed. Instead these characteristic networks can be computed once and for all at module import. Patch attached.

(note: the lru_cache() decorator seems to mitigate this in micro-benchmarks, but the common pattern is not to call .is_private on always the same address :-))

----------
components: Library (Lib)
files: ipaddr_props.patch
keywords: patch
messages: 218630
nosy: ncoghlan, pitrou, pmoody, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: speed up some ipaddress properties
type: performance
versions: Python 3.5
Added file: http://bugs.python.org/file35260/ipaddr_props.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21513>
_______________________________________


More information about the Python-bugs-list mailing list