New submission from Jonathan <qjonathandan...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue32595>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to