PERF: Revert previous change.

Using file system directly is 4x times faster.

--HG--
branch : 1.x
This commit is contained in:
Renaud Paquay
2011-06-01 14:38:55 -07:00
parent a721f20802
commit dda45b654e

View File

@@ -116,11 +116,17 @@ namespace Orchard.FileSystems.VirtualPath {
}
public virtual DateTime GetFileLastWriteTimeUtc(string virtualPath) {
#if true
// This code is less "pure" than the code below, but performs fewer file I/O, and it
// has been measured to make a significant difference (4x) on slow file systems.
return File.GetLastWriteTimeUtc(MapPath(virtualPath));
#else
var dependency = HostingEnvironment.VirtualPathProvider.GetCacheDependency(virtualPath, new[] { virtualPath }, DateTime.UtcNow);
if (dependency == null) {
throw new Exception(string.Format("Invalid virtual path: '{0}'", virtualPath));
}
return dependency.UtcLastModified;
#endif
}
public string GetFileHash(string virtualPath) {