[pacman-dev] Tar backend for local db

Dan McGee dpmcgee at gmail.com
Thu Nov 1 09:40:01 EDT 2012


On Thu, Nov 1, 2012 at 8:27 AM, keenerd <keenerd at gmail.com> wrote:
> From my experience writing non-libalpm pacman clients, you could
> reduce that by 13 seconds if you lazily loaded the local DB.  There is
> no reason to walk and parse the data of hundreds of packages when the
> user is explicitly asking for one.

Your non-libalpm clients must never need to compute reverse
dependencies (e.g. requiredbys) then. There is quite a good reason we
*have* to parse the rest when we show either info or need to compute
dep chains during sync or upgrade operations.

A simple `pacman -Q glibc` operation (to see if the package is
installed locally) doesn't open more than a handful of files, and we
don't even have to open the actual files in the local database- we
only scan the directory.

-Dan


$ strace -e open,openat,getdents pacman -Q glibc
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libalpm.so.7", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libgpgme.so.11", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libarchive.so.12", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libcurl.so.4", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libcrypto.so.1.0.0", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libassuan.so.0", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libgpg-error.so.0", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libacl.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libattr.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libexpat.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/liblzma.so.5", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libbz2.so.1.0", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libssh2.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libssl.so.1.0.0", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
open("/etc/pacman.conf", O_RDONLY)      = 3
open("/etc/pacman.d/mirrorlist", O_RDONLY) = 4
open("/etc/pacman.d/mirrorlist", O_RDONLY) = 4
open("/etc/pacman.d/mirrorlist", O_RDONLY) = 4
open("/etc/pacman.d/mirrorlist", O_RDONLY) = 4
open("/etc/pacman.d/mirrorlist", O_RDONLY) = 4
open("/etc/pacman.d/mirrorlist", O_RDONLY) = 4
open("/etc/pacman.d/mirrorlist", O_RDONLY) = 4
openat(AT_FDCWD, "/var/lib/pacman/local/",
O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
getdents(3, /* 802 entries */, 32768)   = 32752
getdents(3, /* 436 entries */, 32768)   = 18464
getdents(3, /* 0 entries */, 32768)     = 0
open("/etc/pacman.conf", O_RDONLY)      = 3
open("/etc/pacman.d/mirrorlist", O_RDONLY) = 4
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 4
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) =
-1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) =
-1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT
(No such file or directory)
open("/etc/pacman.d/mirrorlist", O_RDONLY) = 4
open("/etc/pacman.d/mirrorlist", O_RDONLY) = 4
open("/etc/pacman.d/mirrorlist", O_RDONLY) = 4
open("/etc/pacman.d/mirrorlist", O_RDONLY) = 4
open("/etc/pacman.d/mirrorlist", O_RDONLY) = 4
open("/etc/pacman.d/mirrorlist", O_RDONLY) = 4
openat(AT_FDCWD, "/var/lib/pacman/local/",
O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
getdents(3, /* 802 entries */, 32768)   = 32752
getdents(3, /* 436 entries */, 32768)   = 18464
getdents(3, /* 0 entries */, 32768)     = 0
glibc 2.16.0-5
+++ exited with 0 +++


More information about the pacman-dev mailing list