Click to See Complete Forum and Search --> : Fast File Information: WINAPI vs C++


xygorn
February 17th, 2003, 11:14 AM
Hello,

I am looking for a fast way to create a data structure to hold a directory tree and information on files in the directory tree. As the filesystem that is being loaded into the data structure is large, speed is a significant issue.
I am aware of three possible techniques to get the information I need. Two of these are from WINAPI:

FindFirstFile and FindNextFile
and
GetFileInformationByHandle

The third option is using c++ library calls:

_findfirsti64 and _findnexti64

The data structure is being used in an Activex Control embedded in a Visual Basic program to offload the building of the stucture and querying the structure to C++.

Is it common knowledge which of these is a faster general solution? Are different solutions faster in different scenarios (OS,File system,RAM amount)? Are there other factors that I should be aware of when selecting one of these options? Is there a fourth solution that would be better than any of these? (Note: I do need all of the pieces of information provided by these functions)

Thank you for your help,

Eli Gibson

Bob Davis
February 20th, 2003, 10:01 PM
Why not just try them all and see which one works best? It shouldn't take much modification to plug in one method or the other, or you could use preprocessor directives to choose which one you want.


// wherever you need to find a file
#ifdef METHOD_1
// enter your FindFirstFile stuff here
#else
#ifdef METHOD_2
// enter your GetFileInformationByHandle stuff here
#else
#ifdef METHOD_3
// enter your findfirsti64 stuff here
#endif


I'm not exactly sure if that syntax is correct, but you get the idea. The best way to figure out what works best is to try them all. With 3 simple approaches, empirical testing is probably your best bet.