Re: File Searching, how to speed it up?
- From: Bob Grommes <bob@xxxxxxxxxxxxxx>
- Date: Sun, 27 May 2007 17:46:06 -0700
Better still perhaps: a service that either uses a watcher to update your saved file list, or just scans periodically and does the update, so that when your app is executed, it's already current, or has a short list of changed files to scan.
--Bob
Bob Grommes wrote:
This may or may not be a good trade-off, but possibly moving a lot of this logic to a Windows service that continually maintains a (preferably in-memory) listing and provides an API for your app to access that data, is something to consider..
Also, no personal experience here, but a file system watcher might be able to notify your app (or service) when something changes in a particular directory, thus avoiding a complete re-scan.
--Bob
janderson wrote:Hi,
I have a win32 C# app that needs to recursively search for a particular file type really fast. It always searches the same place for these files.
I'm using Directory.GetDirectories and Directory.GetFiles to do it currently. Because I know the location is the same every time I build a cache of all the files and directories. If a directory changes I update its contents on startup of the app.
Unfortunately when I do a last-date-of-modification check on a directory it only reports on changes of files that are directly under it. So I have to check every single directly rather then simply checking the parent directory.
While I get a significant improvement when none of the directories change (its much faster to load a file with all the entries in it then to do a directory search). In particular the first time the app loads up and has to search every file (around 100,000 and growing) which is painfully slow (2 or 3 minutes to start up the app).
What techniques/APIs can I use to speed up file searching?
Is there a way to more directly look at the raw data that make up the file-tables?
Cheers
- References:
- File Searching, how to speed it up?
- From: janderson
- Re: File Searching, how to speed it up?
- From: Bob Grommes
- File Searching, how to speed it up?
- Prev by Date: Re: File Searching, how to speed it up?
- Next by Date: Re: File Searching, how to speed it up?
- Previous by thread: Re: File Searching, how to speed it up?
- Next by thread: Re: File Searching, how to speed it up?
- Index(es):
Relevant Pages
|
Loading