From owner-freebsd-hackers Fri May 25 13:26:20 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from maxim.gbch.net (gw.gbch.net [203.24.22.66]) by hub.freebsd.org (Postfix) with SMTP id EB93137B423 for ; Fri, 25 May 2001 13:26:14 -0700 (PDT) (envelope-from gjb@gbch.net) Received: (qmail 18424 invoked by uid 1001); 26 May 2001 06:26:11 +1000 Message-ID: X-Posted-By: GJB-Post 2.19 02-May-2001 X-Operating-System: FreeBSD 4.2-RELEASE i386 X-Location: Brisbane, Australia; 27.49841S 152.98439E X-URL: http://www.gbch.net/gjb.html X-Image-URL: http://www.gbch.net/gjb/gjb-auug048.gif X-GPG-Fingerprint: EBB2 2A92 A79D 1533 AC00 3C46 5D83 B6FB 4B04 B7D6 X-PGP-Public-Keys: http://www.gbch.net/keys.html Date: Sat, 26 May 2001 06:26:11 +1000 From: Greg Black To: hackers@FreeBSD.ORG Subject: Re: technical comparison References: <200105251718.VAA06296@aaz.links.ru> In-reply-to: <200105251718.VAA06296@aaz.links.ru> of Fri, 25 May 2001 21:18:05 +0400 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I would have sent this to the original author if he had used a proper email address on his post; sorry to those who don't want to see it. | > | I have files fooX where X is a number from 00000 to 60000 in that | > | directory. I need to find a piece of information, so I run that | > | information through a hash of some sort and determine that the file I want | > | is number 23429, so I open that file. | > | > And if this imaginary program is going to do that, it's equally | > easy to use a multilevel directory structure and that will make | > the life of all users of the system simpler. There's no real | > excuse for directories with millions (or even thousands) of | > files. | There is. | You assume that names are random. | Assume that they are not. | VERY old example: | a | aa | ... | aaaaaaa...aaa 255 times | aaaaaaa...aab | so on. | Yes, I know: hash. | | Is it practical to this in every application | (sometimes it is unknown before practical use | if directories become big) instead in | one file system? Any real programmer has tools that make this trivial. I keep a pathname hashing function and a couple of standalone programs that exercise it from shell scripts in my toolbox and can stitch them into anything that needs fixing in no time. My code allows for nearly 1.3 trillion names in a six-level hierarchy if you can limit yourself to about 500 hundred names per directory, but can be easily extended for really idiotic uses. | Sorry for a bad English. We can live with that, but it's a bit rude to send messages out without a valid "From" address. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message