Issue #16398: Optimize deque.rotate()