No subject

utzoo!decvax!ucbvax!unix-wizards utzoo!decvax!ucbvax!unix-wizards
Thu Sep 17 16:37:40 AEST 1981


>From decvax!duke!trt at Berkeley Thu Sep 17 16:26:34 1981
"ls -l" is annoyingly slow on a large directory.
Here are two ideas that might speed things up.
They are probably best implemented in the kernel.

1. Change namei to search a directory starting where it last stopped,
rather than always starting from the beginning.
Then successive stats do not take quadratic time.
It should re-check the old entry rather than start with the next
so that stats of "/usr/spool/..." will immediately find usr and spool.
   The incore inode might have an "offset" field which is initially 0
and is updated each time namei finds something.
(Perhaps the triple-indirect-block field could hold the offset.)

2. Keep directory entries sorted in ascending i-number order
(except "." and "..", since lazy programs expect them first).
Then successive stats will sweep the i-list smoothly.

3. Related speedup: Assign i-numbers to files so directories contain
consequtive i-numbers (mostly), in descending access frequency.
This last is not too easy to put in the kernel, I suppose.
		Tom Truscott (duke!trt)



More information about the Comp.unix.wizards mailing list