Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Speed up PO compiling when there are a lot of entries to remove
polib implements deserialized po files as subclasses of `list`. Thus, hen you want to remove an entry, you can either use `.remove` or `del`. `.remove` (the one we were using so far) does a serial search in the po file until it finds the entry to remove. If the po file is big and you are doing lots of removals, this can become unbearable. This implementation instead uses `del`. While iterating through the po file, we add the indexes of the entries we want to remove in a list. After the iteration is finished, we go through that list in reverse order and use `del` to remove the entries. Since `del` does not do a serial search, it is noticeably faster.
- Loading branch information