tante/gmaillabelpurge — pull request #5 by Flameeyes (2013-01-26 03:48:37+00:00)
Title: Performance improvements

So after trying to cleanup two and a half months worth of messages, I had to find a way to improve the performance and I indeed ended up learning some more about Python ;)

There might still be chance for optimizing this further (mostly by sending a batch of UIDs to tackle rather than doing so one at a time), but this more than halved the time that it takes to empty a folder of mine.

Basically it avoids iterating over the messages more than once per folder, and even then, it's just to print what it's going to happen, more than anything else, as the archival or deletion happens as a batch operation after using search.

There are a few minor optimizations that can be possible, but I'll work on that tomorrow most likely after implementing Issue #3 :)