New submission from Michel Albert:

This alternative implementation runs over the ``addresses`` collection only 
once, and "backtracks" only if necessary. Inspired by a "shift-reduce" approach.

Technically both are O(n), so the best case is always the same. But the old 
implementation runs over the *complete* list multiple times until it cannot 
make any more optimisations. The new implementation only repeats the 
optimisation on elements which require reconciliation.

Tests on a local machine have shown a considerable increase in speed on large 
collections of elements (iirc about twice as fast on average).

----------
components: Library (Lib)
files: faster-collapse-addresses.patch
keywords: patch
messages: 212553
nosy: exhuma, ncoghlan, pmoody
priority: normal
severity: normal
status: open
title: Faster implementation to collapse consecutive ip-networks
type: performance
versions: Python 3.5
Added file: http://bugs.python.org/file34267/faster-collapse-addresses.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20826>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to