No, it doesn't, because as I explicitly said, I made two version of the algorithm, one with reorganization and one without. You see, the additional operations required to pick out each and every time sum up to more than the cost of reorganization at start, particularly when the data is operated on multiple times. The more complex the operation, the greater the ultimate penalty.
Here's a fiddle of the whole thing, complete with benchmarking. The operation takes a while so you'll need to either leave the browser alone during the process (the browser will become unresponsive during the benchmarking), or approve the prompts if your browser tries to time it out.
Instructions: Browse for any two different images using the buttons provided (Image and Palette). Then click "Repalette". The first image will be recolored to match the palette of the second. You won't be able to see it though, 1) because the benchmarking requires the original image be used rather than the recolor; and 2) browsers like Firefox have runover problems between setTimeout and long-running code. (I could fix that... it's not a priority. If you want to see the recolor, comment out the setTimeout in Repalette().)