Use access() instead of stat() when possible
commit29bf6814f74096e5d8ea22058e638eb362717b8a
authorDan McGee <dan@archlinux.org>
Mon, 16 Jun 2008 00:15:36 +0000 (15 19:15 -0500)
committerDan McGee <dan@archlinux.org>
Mon, 16 Jun 2008 03:52:27 +0000 (15 22:52 -0500)
tree1b608ba8071c1c7e52808a4b178ba8225ef6d2b1
parent7ff5a917fd0a91cd03ba61419a57053e4ae17e92
Use access() instead of stat() when possible

We were using the stat() system call in quite a few places when we didn't
actually need anything the stat struct returned- we were simply checking for
file existence. access() will be more efficient in those cases.

Before (strace pacman -Ss pacman):
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 33.16    0.005987           0     19016           stat64

After:
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 34.85    0.003863           0     12633         1 access
  7.95    0.000881           0      6391         7 stat64

Signed-off-by: Dan McGee <dan@archlinux.org>
lib/libalpm/be_files.c
lib/libalpm/trans.c
lib/libalpm/util.c
src/pacman/package.c
src/pacman/util.c
src/util/testdb.c