How fast is File.Exists

  • Thread starter Thread starter niama
  • Start date Start date
N

niama

Hi,

This could be a simple thing which I can't decide on. I am working a
Document Management System where I need to store the files in a File
Server. I was given only one choice that I can only create only one
folder and all the files should go under it. My questions is, if I
follow this strategy of storing all files in one folder, will it affect
the performance of the method File.Exists(). Ultimately will it affect
the search functionality?

Thanks in advance,
Niru Baktha.
 
My questions is, if I
follow this strategy of storing all files in one folder, will it affect
the performance of the method File.Exists().

Why don't you measure it? I don't think you'll see any significant
perf degradation, but it may well depend on the file system and the
number of files we're talking about.


Mattias
 
HI,

niama said:
Hi,
My questions is, if I
follow this strategy of storing all files in one folder, will it affect
the performance of the method File.Exists(). Ultimately will it affect
the search functionality?

Possibly , I have notice that in an external HDD where there are several
thousand files in the same directory it's slower if they are organized in
folders.
How slow would it be in your case is easy to know, just create a number of
random files and see the performance under different storing strategic, you
could use from the simples one ( alphabetically) to more complex hashing
structures.
 
If you really, REALLY have a lot of files and you are concerned about
performance, you could always store a static Hashtable with the filenames
from the directory at app startup. Then all your "exists" lookups would be in
memory.
Hope that's fast enough!

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top