Optimise checking process names for equality.

Some files with very complex names take a long time to compare the
names for equality. This caches the hash values of names in order to
save time.