[New-bugs-announce] [issue32595] Deque with iterable object as one object

Jonathan report at bugs.python.org
Thu Jan 18 14:53:57 EST 2018


New submission from Jonathan <qjonathandaniel at gmail.com>:

Creating a deque with an iterable object creates extra overhead if you want to insert it as one element.

e.g:
import timeit

test1 = '''
str = "x" * 100000
lst = [str]
'''

test2 = '''
str = "x" * 100000
'''

print(timeit.timeit(test1, number=100000))
print(timeit.timeit(test2, number=100000))

If I want to add a string to a deque i will have to put it in a list first, this causes 23% slower performance in my case.

There should be a deque where this overhead is not needed because in most cases this will be used in performance demanding cases.

----------
components: Library (Lib)
messages: 310256
nosy: jonathandaniel
priority: normal
severity: normal
status: open
title: Deque with iterable object as one object
type: performance
versions: Python 2.7

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


More information about the New-bugs-announce mailing list