Text File

Aucbvax.3193 fa.unix-wizards utzoo!decvax!ucbvax!unix-wizards Thu Sep 17 16:37:40 1981

>From decvax!duke!trt@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)

----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen <jgoerzen@complete.org> of http://communication.ucsd.edu/A-News/

This Usenet Oldnews Archive article may be copied and distributed freely, provided:

1. There is no money collected for the text(s) of the articles.

2. The following notice remains appended to each copy:

The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.