New submission from Simon Law:

If you look at the implementation of deque.rotate(), it does the equivalent of 
deque.append(deque.popleft()) or deque.appendleft(deque.pop()).

Unfortunately, for larger rotations, the pop() and append() calls just do too 
much work. Since the documentation recommends using rotate() to do 
slicing-style operations, this could get seriously slow.

deque.rotate() could just touch up the internal pointers and use memmove() to 
realign the data.

Benchmarks, of course, would have to be written to make sure this is a win.

----------
components: Library (Lib)
messages: 174679
nosy: sfllaw
priority: normal
severity: normal
status: open
title: deque.rotate() could be much faster
type: performance
versions: Python 2.7, Python 3.2, Python 3.3

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

Reply via email to