Spiritual successor to #5180
See #5180 (comment)
Could also take a look at the Constructor? I stopwatched it taking 400ms (while not as much as RemoveDependenciesFromEntryIfMissing()), I expected it to take only 40-50ms. I refactored disk access from the timer and it still took the same time, thus issue is somewhere else.
edit I should add when I say Constructor() I really meant the function ConstructDependencyTable(). This inner loop is also a great candidate for parallel foreach.
Spiritual successor to #5180
See #5180 (comment)