Directions for improvement

Jan 7, 2012 at 8:02 PM

Great work, great idea!

However there are number of of things that can be improved:

1. ZlpDirectoryInfo.GetFiles/GetDirectories uses Win32 FindFirstFile/FindNextFile/FindClose API that returns structure filled with complete file/directory info (length, attributes, etc). Despite that only cFileName field is used to initialize new instance of ZlpFileInfo/ZlpDirectoryInfo. That means that for every ZlpFileInfo/ZlpDirectoryInfo property invocation there would be another unavoidable P/Invoke call to Win32 API despite the fact that all information was present in advance. Imagine what a performance would be if I'll need all the properties for every file (that is my real use case)

2. Do not use recursion for GetFiles/GetDirectories. You never know how many nested folders there can be. So it is very easy to get StackOverflowException executing ZlpIOHelper.GetFiles(@"C:\", SearchOption.AllDirectories) (which in turn would crash the entire process)

3. ZlpDirectoryInfo.LastWriteTime and other properties would not work for folders with trailing spaces in their name. I had a case when ZlpDirectoryInfo.GetDirectories returned such a directory that is throwing exceptions for each of its properties. This would be automatically fixed by #1

4. It is good idea to use FindFirstFileEx instead of FindFirstFile. For Windows7+ it can be used with FindExInfoBasic detail level and FIND_FIRST_EX_LARGE_FETCH flag. That would improve performance of disk scanning alot

5. There is no ZlpDirectoryInfo.GetFileSystemEntries method. That means in case when I need both files and directories there would be 2 directory scans (for files and for directories) instead of one. That harms performance especially in case when there are thousands of files and subfolders in the folder

6. There are no analogs to System.IO.Directory.EnumerateFiles/EnumerateDirectories/EnumerateFileSystemEntries methods

Jan 17, 2013 at 1:21 PM

Hi,

Are you aware of http://alphafs.codeplex.com/
Definitely worth a look!

Regards,
Yomodo