[issue21486] optimize v4 & v6 netmask parsing

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

[issue21486] optimize v4 & v6 netmask parsing

2014-05-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset 2158614e1607 by Antoine Pitrou in branch 'default': Issue #21486: Optimize parsing of netmasks in ipaddress.IPv4Network and ipaddress.IPv6Network. http://hg.python.org/cpython/rev/2158614e1607 -- nosy: +python-dev _

[issue21486] optimize v4 & v6 netmask parsing

2014-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: Actually, using lru_cache(maxsize=None) would enable a simple infinite cache like in the patch. But it's not like a lot of code would be saved. -- ___ Python tracker _

[issue21486] optimize v4 & v6 netmask parsing

2014-05-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What I want to say, the patch LGTM, but after committing issue14373 we should simplify the code by using functools.lru_cache(). -- ___ Python tracker ___

[issue21486] optimize v4 & v6 netmask parsing

2014-05-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: With C implementation (issue14373) functools.lru_cache is so fast as manually written specialized code. -- ___ Python tracker ___ ___

[issue21486] optimize v4 & v6 netmask parsing

2014-05-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: Because that would incur the cost of LRU logic and locking, which we don't need here. -- ___ Python tracker ___ ___

[issue21486] optimize v4 & v6 netmask parsing

2014-05-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Why not just use functools.lru_cache? -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python

[issue21486] optimize v4 & v6 netmask parsing

2014-05-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: Updated patch, also optimizing v6 netmask parsing (same principle). Before patch: $ ./python -m timeit -s "import ipaddress" "net = ipaddress.IPv6Network(('2001:db8::', 96))" 1 loops, best of 3: 26.1 usec per loop $ ./python -m timeit -s "import ipaddress