Since the todo list can sometimes become very large "remove" becomes comically inefficient due to the need to shuffle all items to the left: in the worst case I've observed it taking 99% of program execution time. Using a deque largely solves this problem. On a really nasty example this reduces execution time on my machine from over 9 minutes to 9 seconds.
Since the todo list can sometimes become very large "remove" becomes comically inefficient due to the need to shuffle all items to the left: in the worst case I've observed it taking 99% of program execution time. Using a deque largely solves this problem. On a really nasty example this reduces execution time on my machine from over 9 minutes to 9 seconds.