in reply to Code Optimization

For one thing, if you have to do "millions" of permutations, you cannot afford to re-read any file within that loop.