Re: What is the fastest way to determine if folder has subfolders or not!?





"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]




.



Relevant Pages

  • Re: Fantasy Books not set in pseudo-Europe
    ... looking for this sort of thing and haven't read those, ... you have to go to the entries on the 1001 Nights and on "Persia" ... <Wheel of the Infinite> ... Fantasy rooted in no particular Earth historical culture is not, ...
    (rec.arts.sf.written)
  • How to sort the variable length objects in Lexicographical order?
    ... I am involved in the Agent development for providing the support for ... about the lexicographic ordering of the table entries with respect to ... Because we need to sort the connection table based on four parameters ...
    (comp.protocols.snmp)
  • Re: iA32 Paging
    ... > Page Dir Page Frame Offset ... > My problem is with the page directory and page frame data entries. ... entry has anything to do with the physical address. ... The 10 bit Page Table Offset from the linear ...
    (comp.lang.asm.x86)
  • Re: iA32 Paging
    ... >> Page Dir Page Frame Offset ... >> My problem is with the page directory and page frame data entries. ... > entry has anything to do with the physical address. ... The 10 bit Page Table Offset from the linear ...
    (comp.lang.asm.x86)
  • Re: Important regression with XFS update for 2.6.24-rc6
    ... a directory with 15000 entries (btree format) used about 5MB of RAM. ... offset so that filldir got what it expected when filling the user buffer. ...
    (Linux-Kernel)

Quantcast