[issue4123] random.shuffle slow on deque

paul rubin report at bugs.python.org
Wed Oct 15 00:03:01 CEST 2008


New submission from paul rubin <phr at users.sourceforge.net>:

This is observed in Python 2.5.1, I haven't tried any later versions.

d = collections.deque(xrange(100000))
random.shuffle(d)

is quite slow.  Increasing the size to 200k, 300k, etc. shows that the
runtime increases quadratically or worse.  It's much faster to convert
the deque to a list, shuffle the list, and make a new deque from the
shuffled list.

----------
components: Library (Lib)
messages: 74773
nosy: phr
severity: normal
status: open
title: random.shuffle slow on deque
versions: Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4123>
_______________________________________


More information about the Python-bugs-list mailing list