fsprojects / FSharp.Management

The FSharp.Management project contains various type providers for the management of the machine.
http://fsprojects.github.io/FSharp.Management/
Other
91 stars 32 forks source link

Invalidations occur too frequently #30

Closed ReedCopsey closed 10 years ago

ReedCopsey commented 10 years ago

The invalidation events occur far too frequently in the FileSystem type provider, and have too large of a scope.

Right now, any time any file within any subfolder of a used path (even if you're not accessing the subfolder) changes, it triggers a full invalidation of all system providers. This is especially nasty because the registry TP invalidates, which is relatively slow to reload.

This is especially problematic when using RelativePath, as VS makes temp folders in within the project directory continually. The 1 second buffer in place makes it usable, but I find that VS frequently locks up when using the RelativePath type provider.

I think two things need to be done to handle this:

1) Each type provider root type should be within a separate TypeProvider, not all bundled within a single one. This would make it so a FileSystem invalidation doesn't force a requery of the registry, etc.

2) The invalidation logic shouldn't include all subfolders, and should only check within paths that are actually being used by the type system. This could be done by using a separate FileSystemWatcher for each folder as they're used (when AddMemberDelayed actually executes), which in turn would invalidate that TP.

I have a branch that implements these ideas - but wanted some feedback before submitting a pull request. Does anybody see a major disadvantage to implementing the two above items?

forki commented 10 years ago

Sounds good to me