On Tuesday, 5 October 2004 02.52, Carlos E. R. wrote:
When postfix is working, it saves a file whose name starts with B* (for example), in a directory starting with the letter B, like ./Defer/B/Bfilename
Perhaps it makes faster searching when there are a lot of messages going around, in the thousands. The trick worked in MsDos, I know, but I was not aware it also worked in *nix.
A directory is a file, rarely sorted in alphabetical order, containing your filenames and the inodes they point to. When you have all files in a single directory, the OS will have to open the directory file and read it sequentially starting from the top. On average, this means opening a file in a standard file system is an O(n) operation, where n is the number of files in the directory structure (if a single directory can be called a structure) Assuming the hash algorithm is balanced enough, doing it the postfix way means you get a 26th as many reads on average, and if you take it to the extreme (a complete tree, with one file (and its collisions) per directory) means you get O(log n) instead of O(n). When you have a huge number of files (or a slow disk system), that can make an enormous difference. It's a pretty standard algorithm for speeding up searches I'm not sure if reiserfs is affected by this, since it already stores files in balanced trees. I'd have to look that up