coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Faster ls when there are thousands of files in a directory


From: Jim Meyering
Subject: Re: Faster ls when there are thousands of files in a directory
Date: Sat, 25 Jun 2011 08:01:40 +0200

Jim Meyering wrote:
> Peng Yu wrote:
>> When there are a few thousands of files/directories in a directory
>> that I want to ls, I experience long wait time (a few seconds on mac).
>> I'm wondering if some kind of cache can be built for ls to speed it
>> up? Note my ls is installed from macport (not the native mac ls).
>
> Use "ls -1U" (efficient with coreutils-7.0 or newer) or find.
>
> Someday GNU ls will use fts, and then it will benefit from
> the inode-sorting fts does for some FS types when there are
> very many files.  Then it will be faster with additional
> combinations of options.  But even then, it won't beat "ls -1U",
> which doesn't call stat at all for FS with useful dirent.d_type.

I went to NEWS to quote that entry and did not find it right away
because there was no use of ls -1 or ls -U there.

I adjusted it like this:

>From 18839ad9c17c3f8fe42210e17c707bfc12fd4b1b Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 25 Jun 2011 07:57:59 +0200
Subject: [PATCH] doc: clarify an improvement from coreutils-7.0

* NEWS (7.0 Improvements): Mention the command: "ls -1U".
* cfg.mk (old_NEWS_hash): Update.
---
 NEWS   |    3 ++-
 cfg.mk |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 619fbdd..d58df26 100644
--- a/NEWS
+++ b/NEWS
@@ -1082,7 +1082,8 @@ GNU coreutils NEWS                                    -*- 
outline -*-
   join has significantly better performance due to better memory management

   ls now uses constant memory when not sorting and using one_per_line format,
-  no matter how many files are in a given directory
+  no matter how many files are in a given directory.  I.e., to list a directory
+  with very many files, ls -1U is much more efficient.

   od now aligns fields across lines when printing multiple -t
   specifiers, and no longer prints fields that resulted entirely from
diff --git a/cfg.mk b/cfg.mk
index 8a0dc9f..ce27cf6 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -27,7 +27,7 @@ bootstrap-tools = autoconf,automake,gnulib,bison
 # Now that we have better tests, make this the default.
 export VERBOSE = yes

-old_NEWS_hash = 792b8dca00fe03568653f7ca2d096d9d
+old_NEWS_hash = 7b32bb1296f27ceca68b3a20956cb1b8

 # Add an exemption for sc_makefile_at_at_check.
 _makefile_at_at_check_exceptions = ' && !/^cu_install_program =/'
--
1.7.6.rc2.302.gc2115



reply via email to

[Prev in Thread] Current Thread [Next in Thread]