Subject: Re: bug#52384: [External] : bug#52384: 26.3; dired buffer navigation tweak

From: Arthur Miller <[email-masked]>
Date: Mon, 13 Dec 2021 11:14:27 +0100

Eli Zaretskii <[email-masked]> writes:

>> From: Arthur Miller <[email-masked]>
>> Date: Sun, 12 Dec 2021 20:15:44 +0100
>> Cc: Michael Perry <[email-masked]>, Stefan Kangas <[email-masked]>,
>>  "[email-masked]" <[email-masked]>
>> 
>> After I posted my comment to Drew, I realized later, that
>> '--group-directories-first' does not exist in all 'ls' implementations. Bsd ls
>> does not seem to have it, correct me if I am wrong, so I am not sure it can be a
>> default for Emacs. Unless Emacs defaults to ls-lisp.el on all platforms but
>> gnu/Linux?
>
> No, ls-lisp.el is not used on any Posix hosts.

I thought so; would it be unrealistic to suggest that Emacs by default switches
to ls-lisp.el on all hosts?

I have done some measurements, not very scientific, just tested simply gnu ls vs
directory-files on my Arch Linux, with a directory ~5000 files. As I see it on
my computer, the most of time is spent on I/O, once the system has cached
inodes, it almost does not matter if I use ls binary or sl-lisp.el, or
directory-files directly:

*** Welcome to IELM ***  Type (describe-mode) for help.
ELISP> (benchmark-run 1 (find-file "/s/backup/unsorted"))
(0.202678959 0 0.0)

ELISP> (benchmark-run 1 (directory-files "/s/backup/unsorted"))
(0.003737047 0 0.0)

ELISP> (benchmark-run 1 (find-file "/s/backup/unsorted"))
(0.001892588 0 0.0)

ELISP> (benchmark-run 1 (find-file "/s/backup/unsorted"))
(0.001898974 0 0.0)

ls is faster of course, but not like a magnitude faster.

That is off a mechanical drive.

Switching to ls-lisp.el would let Dired be stup for consistent behavior on all
platforms and we could have directories grouped by default. At least according
to web search that seems to be often asked question for both Emacs users, and
even MacOS Finder users. With other words, it seems like it is a behavior
prefered by lot of users.