Reuben Thomas wrote:
> On Mon, 25 May 2009, Jim Meyering wrote:
>
>> Reuben Thomas wrote:
>>
>>> On Mon, 25 May 2009, Jim Meyering wrote:
>>>
>>>> To do what he wants you have to know that ls -1U is the only
>>>> way to get one output entry per readdir call.
>>>>
>>>> Reuben, you want to do it like this:
>>>>
>>>>  ls -1U|head|xargs ls -l
>>>
>>> Thanks for the hint about -1, but this doesn't seem to make any
>>> difference: I run "ls -1U|head" in a directory with lots of files
>>> (about 10,000) and it pauses for a minute or so before giving me my
>>> ten lines of output.
>>>
>>> If I run the command again, then of course it runs almost instantly,
>>> so I'm not sure what use the loops are in the tests you give.
>>
>> That amount of delay suggests you're using an old ext2 or ext3 file system.
>> What FS type, distro, kernel, and mount options?
>
> Linux 2.6.26, Debian lenny, reiserfs with mount options defaults,user_xattr.

I get nowhere near 1-minute times for directories with
that many entries on a reiserfs file system.
Though my kernel is 2.6.29-1-amd64, and the file system
is not very old: I reformatted it about 4 months ago.

I'm seeing consistent times < 0.1s for directories containing
up to 20,000 entries.

try running this:

   strace -c ls -1U

that should tell you which syscalls are taking the most time.


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to