title: Fast removal of consecutive duplicates in a list and corresponding items from another list
body: <p>My question is similar to this <a href="https://stackoverflow.com/questions/5738901/removing-elements-that-have-consecutive-dupes">previous SO question</a>.
  I have two very large lists of data (almost 20 million data points) that contain numerous consecutive duplicates. I would like to remove the consecutive duplicate as follows:</p>
  <pre><code>list1 = [1,1,1,1,1,1,2,3,4,4,5,1,2]  # This is 20M long!
  list2 = ...  # another list of size len(list1), also 20M long!
  i = 0
  while i &lt; len(list)-1:
      if list[i] == list[i+1]:
          del list1[i]
          del list2[i]
      else:
          i = i+1
  </code></pre>
  <p>And the output should be <code>[1, 2, 3, 4, 5, 1, 2]</code> for the first list.
  Unfortunately, this is very slow since deleting an element in a list is a slow operation by itself. Is there any way I can speed up this process? Please note that, as shown in the above code snipped, I also need to keep track of the index <code>i</code> so that I can remove the corresponding element in <code>list2</code>.</p>