This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author louielu
Recipients louielu
Date 2017-02-23.16:39:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487867963.03.0.590116533592.issue29634@psf.upfronthosting.co.za>
In-reply-to
Content
There is a XXX in v3.5.0 shows that need to dealing with deque maxlen setting case in deque_repeat.

Although there have common case for deque size 1 with maxlen, other size of deque with maxlen still using for-loop to extend the deque, without any detection.

Adding this fast break will reduce the execution speed when repeat deque with maxlen.

---
$ cat tests.py
from collections import deque
for _ in range(10:
    d = deque(maxlen=100_000)
    d.insert(0, 0)
    d.insert(0, 10)
    d * 10_000_000
$ time ./python_with_patch tests.py
$ time ./python tests.py
History
Date User Action Args
2017-02-23 16:39:23louielusetrecipients: + louielu
2017-02-23 16:39:23louielusetmessageid: <1487867963.03.0.590116533592.issue29634@psf.upfronthosting.co.za>
2017-02-23 16:39:22louielulinkissue29634 messages
2017-02-23 16:39:22louielucreate