Dennis Sweeney <[email protected]> added the comment:
My suspicion was confirmed about PyPy (My PyPy here is Python 3.6.1
(784b254d6699, Apr 16 2019, 12:10:48) [PyPy 7.1.1-beta0 with MSC v.1910 32 bit]
on win32). In what follows, "heapq2.py" had exactly the `class merge` Python
implementation from PR 18427.
pypy -m pyperf timeit -s "from random import random; from heapq import merge;
from collections import deque; iters = [sorted(random() for j in ra
nge(10_000)) for i in range(20)]" "deque(merge(*iters), maxlen=0)"
Mean +- std dev: 191 ms +- 3 ms
pypy -m pyperf timeit -s "from random import random; from heapq2 import merge;
from collections import deque; iters = [sorted(random() for j in r
ange(10_000)) for i in range(20)]" "deque(merge(*iters), maxlen=0)"
Mean +- std dev: 69.3 ms +- 2.2 ms
Another test: PyPy merging 2 iterables of size 100_000:
heapq: Mean +- std dev: 91.4 ms +- 2.4 ms
heapq2: Mean +- std dev: 52.4 ms +- 2.1 ms
PyPy merging 10_000 iterables of size 100:
heapq: Mean +- std dev: 2.74 sec +- 0.07 sec
heapq2: Mean +- std dev: 781 ms +- 19 ms
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38938>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com