Changed the file whitelist to a set.
The performance is about 10x better.