[issue4123] random.shuffle slow on deque

2008-10-16 Thread paul rubin
paul rubin [EMAIL PROTECTED] added the comment: If it's not a bug, it is at least a surprising gotcha that should be documented in the manual. The collections module is described in the library docs as high performance container datatypes but I could not possibly consider the observed behavior

[issue4123] random.shuffle slow on deque

2008-10-16 Thread Antoine Pitrou
Antoine Pitrou [EMAIL PROTECTED] added the comment: Well, perhaps the deque documentation should make it clear that random access is O(n), rather than O(1) for a list. With this information it is easy to infer that operations such as shuffle() can be much slower on a deque. -- assignee:

[issue4123] random.shuffle slow on deque

2008-10-16 Thread Raymond Hettinger
Changes by Raymond Hettinger [EMAIL PROTECTED]: -- assignee: georg.brandl - rhettinger nosy: +rhettinger ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4123 ___

[issue4123] random.shuffle slow on deque

2008-10-16 Thread Raymond Hettinger
Raymond Hettinger [EMAIL PROTECTED] added the comment: Will add a note to the deque docs that random access is O(n). -- priority: normal - low ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4123

[issue4123] random.shuffle slow on deque

2008-10-16 Thread Raymond Hettinger
Raymond Hettinger [EMAIL PROTECTED] added the comment: Patch attached. -- assignee: rhettinger - georg.brandl keywords: +patch Added file: http://bugs.python.org/file11810/dequedoc.diff ___ Python tracker [EMAIL PROTECTED]

[issue4123] random.shuffle slow on deque

2008-10-16 Thread Benjamin Peterson
Benjamin Peterson [EMAIL PROTECTED] added the comment: Done in r66913. -- nosy: +benjamin.peterson resolution: - fixed status: open - closed ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4123

[issue4123] random.shuffle slow on deque

2008-10-14 Thread paul rubin
New submission from paul rubin [EMAIL PROTECTED]: This is observed in Python 2.5.1, I haven't tried any later versions. d = collections.deque(xrange(10)) random.shuffle(d) is quite slow. Increasing the size to 200k, 300k, etc. shows that the runtime increases quadratically or worse. It's