zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Raghavendra D Prabhu <raghu.prabhu13@gmail.com>,
	Zsh workers <zsh-workers@zsh.org>
Subject: Re: [PATCH] Use access instead of stat in hashdir
Date: Mon, 06 Feb 2012 08:20:08 -0800	[thread overview]
Message-ID: <120206082008.ZM8593@torch.brasslantern.com> (raw)
In-Reply-To: <20120206131302.GA46184@Xye>

Thanks for the suggestion, but ...

On Feb 6,  6:43pm, Raghavendra D Prabhu wrote:
} 
} I found that using access instead of two stat calls

There's only one stat() call in the lines that you changed ...?

} results in 
} faster rehash when it is done. I came across this when I noticed 
} too many stat calls while 'strace -c' 

It also results in treating non-regular files as candidates for being
in the hash table, unless there's something about access() that is
implicitly performing the S_ISREG() test.

So you've broken the correctness of the HASH_EXECUTABLES_ONLY option.
Why not just leave it unset instead?  That's why it's an option.
 
}              if (unset(HASHEXECUTABLESONLY) ||
} -                   (stat(pathbuf, &statbuf) == 0 &&
} -                    S_ISREG(statbuf.st_mode) && (statbuf.st_mode & S_IXUGO)))
} +                   !access(pathbuf,X_OK))
}                  add = 1;
}          }


  reply	other threads:[~2012-02-06 16:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-06 13:13 Raghavendra D Prabhu
2012-02-06 16:20 ` Bart Schaefer [this message]
2012-02-06 16:52   ` Bart Schaefer
2012-02-07 22:46   ` Raghavendra D Prabhu
2012-02-08  0:40     ` 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=120206082008.ZM8593@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=raghu.prabhu13@gmail.com \
    --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).