New submission from Louie Lu:

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

----------
components: Extension Modules
messages: 288460
nosy: louielu
priority: normal
severity: normal
status: open
title: Reduce deque repeat execution when maxlen exist and size is not 1
type: enhancement
versions: Python 3.7

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

Reply via email to