zsh-workers
 help / color / mirror / code / Atom feed
From: Vincent Lefevre <vincent@vinc17.net>
To: zsh-workers@zsh.org
Subject: Re: Filename generation: sorting by inode number
Date: Tue, 28 Apr 2015 17:19:50 +0200	[thread overview]
Message-ID: <20150428151950.GB4973@ypig.lip.ens-lyon.fr> (raw)
In-Reply-To: <150425111451.ZM32010@torch.brasslantern.com>

On 2015-04-25 11:14:51 -0700, Bart Schaefer wrote:
> On Apr 25,  7:11am, Mikael Magnusson wrote:
> }
> } Everything is possible with the "o" glob qualifier by virtue of the
> } "e" specifier;
> } zmodload -aF zsh/stat -b:stat b:zstat
> } ls -Udi *(noe:'zstat -L -A REPLY +inode $REPLY:')
> 
> That's why I asked about whether the hash-ordering affected efficiency
> of stat().

Indeed:

$ sudo drop-caches && time grep -q zzz 1000*(oN)
grep -q zzz 1000*(oN)  0.03s user 0.32s system 0% cpu 40.726 total

$ sudo drop-caches && time grep -q zzz 1000*(noe:'zstat -L -A REPLY +inode $REPLY:')
grep -q zzz 1000*(noe:'zstat -L -A REPLY +inode $REPLY:')  0.06s user 0.14s system 12% cpu 1.590 total

but "oc" is slower (confirmed by 3 tests each), even though the files
have been created with no inode change, e.g.:

$ sudo drop-caches && time grep -q zzz 1000*(oc)
grep -q zzz 1000*(oc)  0.01s user 0.19s system 7% cpu 2.589 total

The probable cause is the low ctime resolution (1 second?).

> Although the inode number is available this way, we could
> also get it from the dirent structure.

Yes, this would be more efficient, but perhaps not noticeable.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


  reply	other threads:[~2015-04-28 15:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-25  0:17 Vincent Lefevre
2015-04-25  1:01 ` Bart Schaefer
2015-04-28 15:06   ` Vincent Lefevre
2015-04-25  5:11 ` Mikael Magnusson
2015-04-25 18:14   ` Bart Schaefer
2015-04-28 15:19     ` Vincent Lefevre [this message]
2015-04-28 16:34       ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150428151950.GB4973@ypig.lip.ens-lyon.fr \
    --to=vincent@vinc17.net \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).