Re: [dev] [sbase] [patch] Optimize 'ls' and add '-U'

From: Charlie Paul <charlieap_AT_gmail.com>
Date: Mon, 22 Jul 2013 09:52:36 -0700

But now we are looking at an even more obscure situation.

On Mon, Jul 22, 2013 at 9:45 AM, Evan Gates <evan.gates_AT_gmail.com> wrote:
>
> ls | wc -l has more problems, e.g. \n is a legal character in filenames.
>
> -emg
>
> On Mon, Jul 22, 2013 at 1:36 AM, Nick <suckless-dev_AT_njw.me.uk> wrote:
> > Quoth Martti Kühne:
> >> On Thu, Jul 18, 2013 at 9:00 PM, Galos, David
> >> <galosd83_AT_students.rowan.edu> wrote:
> >> > Based on the discussion in 'coreutils / moreutils - DC a directory counter'
> >> > I have optimized sbase ls to easily handle large directories. The major
> >> > change is that ls no longer calls 'lstat' on files if it does not have to.
> >> >
> >> > This patch also add '-U' which keeps the list from being sorted. When using
> >> > '-U', ls is constant (except for an argv duplicate) memory.
> >>
> >>
> >> While we're at it, why not fully remove the necessity of wc -l?
> >
> > Because 'wc -l' is a much better way to do things in the general
> > case. Remember, "do one thing and do it well". As has already been
> > discussed to death, it's only very unusually large directories that
> > using regular ls|wc -l isn't a reasonable thing to do. But even if
> > it was always slow, this would be the wrong thing to do.
> >
>
Received on Mon Jul 22 2013 - 18:52:36 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 22 2013 - 19:00:07 CEST