Re: What is the fastest way to determine if folder has subfolders or not!?
- From: "[SolarAngel]" <not-for-mail>
- Date: Fri, 26 Aug 2005 13:21:57 +0200
"J French" <erewhon@xxxxxxxxxx> wrote in message news:430ee73d.93007222@xxxxxxxxxxxxxxxxxxxxxxx
| On Thu, 25 Aug 2005 16:34:03 +0200, "[SolarAngel]" <not-for-mail>
| wrote:
<...>
| Remember remote file systems like Novell - or even Unix
|
<...>|
| Well you could put them all in one big file
| - like writing your own filing system
| - it is not that hard - and can be very fast
<...>
| Well, if you have 6000 files you could store them all in one file, and
| get them out by opening the file in Binary mode
|
| You would need to make a 'directory' preferably in another file, which
| contains the file name and its offset in the main file
|
| You could simply sort the 'directory' and then do a binary chop to
| locate a 'mini-file' by name
|
| That way you would only have two files in the real directory, but you
| would have created your own 'disk format'
|
| Updating is a slight problem, the simplest trick is to simply write
| any new (or extended) mini file to the end of the large file
| - if necessary just mark the old space as deleted
|
| Periodically you could run a cleanup
|
| If you want to get clever, then you could make the system re-use
| unused space in the large file.
|
| Interestingly, this is pretty fast, especially on FAT systems where
| the directory is totally un-indexed so adding a new file means that
| the OS has to run through all 6000 directory entries to see whether
| the new file name exists.
|
| This sort of stuff does work very nicely, and is a good way of storing
| all sorts of data.
|
| If you decide to go down this path, then there are a few pointers that
| I can give you - I've written several generations using this apprach,
| and learned from my mistakes.
|
Ah, I got it q=)
in binary tree search on 6000 entries would take 12 steps.
I should make my own File System, divide it into alocation units for small files small units, and to make indexed table of name
entries and offsets. Deleting files would just remove entries from indexed table (good idea would be to have table of freed units
for faster getting of free units, and if there is none free, using last unit offset + 1)...
I sew VMWare has sdk for their disk format maybe beter idea would be to use their disk driver and sdk for such job.
In my case there are more than 100000 files involved in somewhere around 200~300 directories where there are files from 10k to 1mb,
I am thinking only to make indexed list of directories and files to speed up things. Also and information in those files should not
be available only to my app.
[SolarAngel]
.
- References:
- Re: What is the fastest way to determine if folder has subfolders or not!?
- From: Randy Birch
- Re: What is the fastest way to determine if folder has subfolders or not!?
- From: Tom Esh
- Re: What is the fastest way to determine if folder has subfolders or not!?
- From: Tom Esh
- Re: What is the fastest way to determine if folder has subfolders or not!?
- From: Donald Lessau
- Re: What is the fastest way to determine if folder has subfolders or not!?
- From: Tom Esh
- Re: What is the fastest way to determine if folder has subfolders or not!?
- From: J French
- Re: What is the fastest way to determine if folder has subfolders or not!?
- From: Tom Esh
- Re: What is the fastest way to determine if folder has subfolders or not!?
- From: J French
- Re: What is the fastest way to determine if folder has subfolders or not!?
- From: [SolarAngel]
- Re: What is the fastest way to determine if folder has subfolders or not!?
- From: J French
- Re: What is the fastest way to determine if folder has subfolders or not!?
- From: [SolarAngel]
- Re: What is the fastest way to determine if folder has subfolders or not!?
- From: J French
- Re: What is the fastest way to determine if folder has subfolders or not!?
- Prev by Date: Re: gettickcount returns a negative number???
- Next by Date: Re: gettickcount returns a negative number???
- Previous by thread: Re: What is the fastest way to determine if folder has subfolders or not!?
- Next by thread: Re: What is the fastest way to determine if folder has subfolders or not!?
- Index(es):
Relevant Pages
|