Theodore Tso <tytso@mit.edu> writes:Yeah, Carl suggested this as well. Sorting by inode is a major improvement. The numbers are less stable, but consistently much lower: Time to readdir(): 0.238737 s Time to stat 2366 files: 1.338904 s compared to Time to readdir(): 0.227599 s Time to stat 2366 files: 7.981752 s Of course, 1.3 seconds is still far from instant, but it may be the best we can get given the realities of ext3 disk layout. One thing that surprised me is that lstat is slightly slower than stat. With lstat() instead of stat(), I get: Time to stat 2366 files: 1.472115 s Time to readdir(): 1.735542 s I naively thought that stat() was a superset of lstat(), but apparently not. After I read Carl's mail I looked at what glib - which is used by both Nautilus and the gtk+ file open dialog - does, and in fact the latest version does actually read chunks of 1000 dirents and sorts them by inode. The version I had installed when I wrote the benchmark just stat'ed in readdir() order. For a directory of ~2360 files, chunks of a 1000 files is actually surprisingly worse than statting all of the files at once: Time to stat 1000 files: 1.008735 s Time to stat 1000 files: 0.738936 s Time to stat 366 files: 0.217002 s I guess this just shows that seeks really is pretty much all that matters. Glib should maybe use a larger chunk size. I don't know if a general library outside glib would be useful. It seems that just telling people to "sort by inode before statting" would be just as effective as telling them "use this optimized library". Thanks, Soren --
| Greg Kroah-Hartman | [PATCH 001/196] Chinese: Add the known_regression URI to the HOWTO |
| Linus Torvalds | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| David Newall | Re: Slow DOWN, please!!! |
| Ian Campbell | Re: [PATCH] x86: Construct 32 bit boot time page tables in native format. |
| Matthias Scheler | Re: HEADS UP: timecounters (branch simonb-timecounters) merged into -current |
| Greg Troxel | Re: Interface to change NFS exports |
| Thor Lancelot Simon | metadata cache and memory fragmentation |
| YAMAMOTO Takashi | amap memory allocation |
git: | |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Gerrit Renker | [PATCH 0/37] dccp: Feature negotiation - last call for comments |
| David Miller | [GIT]: Networking |
| Dushan Tcholich | Re: ksoftirqd high cpu load on kernels 2.6.24 to 2.6.27-rc1-mm1 |
