Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Nov 2007 17:25:49 +0100
From:      cpghost <cpghost@cordula.ws>
To:        "Mark Evans" <mbe2@bayou.com>
Cc:        questions@freebsd.org
Subject:   Re: ls -l takes a forever to finish.
Message-ID:  <20071128172549.00eb2ddc@epia-2.farid-hajji.net>
In-Reply-To: <002001c831d5$80ad8670$0d00a8c0@bayoucshaffer>
References:  <005901c8313f$f7048b70$0d00a8c0@bayoucshaffer> <474CA49D.50306@FreeBSD.org> <002001c831d5$80ad8670$0d00a8c0@bayoucshaffer>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 28 Nov 2007 09:44:03 -0600
"Mark Evans" <mbe2@bayou.com> wrote:

> No we are not using NIS.
> 
> it is a large directory i am listing.  actually it is the /usr/home 
> directory, and is probably the largest on the system. However "ls -l"
> runs for close to six minutesand spends the 10 seconds scrolling the
> screen with the results.  so i wait ls to start showing the results
> for about 5 and a half minutes.   Even on a older and much slower
> system i've never seen it talk more than 15 seconds to complete.

Does it run (much) faster with the -f flag or -lf flags?

I have a similar problem with *huge* directories: sorting them is
incredibly slow... though -l makes no difference; it's the sorting
itself than makes one think it is O(N^2) instead of O(N log N).

It could be a pathological case of Quicksort (ls(1) calls fts_open(),
which itself calls fts_sort() from /usr/src/lib/libc/gen/fts.c, and
that function calls qsort(3); so it's not entirely impossible...

-cpghost.

-- 
Cordula's Web. http://www.cordula.ws/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071128172549.00eb2ddc>