Hello, recently Theodory Tso posted a patch for the ext2fs driver, which improves speed of find and similar programs. Background: the application access all entries in the directory in the order they are stored on the disk. The current ext2 (and apparently Ext3) run a lookup function for each readdir call, starting with the first node! Theodore stores a refference to the node which was accessed recently, so the next lookup begins there and only one iteration is needed in best case. My own test with "time ls -l" in a directory with 50000 files: real 0m5.507s user 0m1.880s sys 0m0.940s root@zombie:/tmp/ext2patched> real 0m4.341s user 0m1.890s sys 0m1.010s root@zombie:/tmp/reiser> real 1m54.355s user 0m2.060s sys 1m50.370s root@zombie:/tmp/ext3> I don't remember the result of ext2 before patching, it was about 1.45s IIRC. You see, ext3 is the looser and needs about 10000 percent more CPU time. I looked at the similar routines in ext3 code and it may be optimised too, but I am not familiar with the code so I don't want to start experimenting on the kernel. The ext2 patch is attached. Gruss/Regards, Eduard. -- "Programmieren ist kalter Kaffee" (aus einer PC-Zeitschrift)
Hi, On Mon, Aug 20, 2001 at 03:20:13PM +0200, Eduard Bloch wrote:> I don't remember the result of ext2 before patching, it was about 1.45s > IIRC. You see, ext3 is the looser and needs about 10000 percent more > CPU time. I looked at the similar routines in ext3 code and it may be > optimised too, but I am not familiar with the code so I don't want to > start experimenting on the kernel. The ext2 patch is attached.Yep, I know. Ted is sitting opposite me as we speak, in fact. :-) The ext2 patch he posted is broken, and ext3 doesn't use the page cache so it can't use precisely the same patch, but yes, I'll add a version of this into ext3. Cheers, Stephen
On Mon, Aug 20, 2001 at 03:20:13PM +0200, Eduard Bloch wrote:> My own test with "time ls -l" in a directory with 50000 files: > > real 0m5.507s > user 0m1.880s > sys 0m0.940s > root@zombie:/tmp/ext2patched> > > real 0m4.341s > user 0m1.890s > sys 0m1.010s > root@zombie:/tmp/reiser> > > real 1m54.355s > user 0m2.060s > sys 1m50.370s > root@zombie:/tmp/ext3> > > I don't remember the result of ext2 before patching, it was about 1.45s > IIRC.Ext2 before patching was only 1.45s *if* the entries were already in the dcache. If they weren't already in the dcache, the time should have been similar to the ext3 time (i.e., minutes, not seconds). If you don't unmount and remount the filesystem immediately before doing the "/usr/bin/time ls -l > /dev/null" test, the results will be invalid, since you'll be measuring the effect of the dcache, and not the underlying filesystem. - Ted