Use a hash table for duplication detection

This gives a significant speed up on larger projects (ten thousands of
files).