[New-bugs-announce] [issue38938] Iterable merge performance and inclusion in itertools

Dennis Sweeney report at bugs.python.org
Thu Nov 28 21:44:21 EST 2019


New submission from Dennis Sweeney <sweeney.dennis650 at gmail.com>:

Although the implementation of the heapq.merge function uses an underlying heap structure, its behavior centers on iterators. For this reason, I believe there should either be an alias to this function in the itertools module or at least a recipe in the itertools docs describing the use of heapq.merge.

Furthermore, I have an implementation (attached) of heapq.merge that is twice as fast for two iterables (as used in mergesort and other common cases), and is faster for up to 6 or 7 iterables. I think it would be nice to special-case this for small numbers of iterables for this significant speedup.

----------
components: Library (Lib)
files: iter_merge.py
messages: 357631
nosy: Dennis Sweeney
priority: normal
severity: normal
status: open
title: Iterable merge performance and inclusion in itertools
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file48747/iter_merge.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38938>
_______________________________________


More information about the New-bugs-announce mailing list