5909f93e30
It looks like that, unlike in perl, pattern matching in awk is very slow. Perhaps they just don't have regexp engine hackers like Larry Wall or Ilya Zakharevich (or, most recently, Yves Orton aka demerphq). That's okay, since I can rewrite the script without pattern matching at all. That is, I don't have to split each index line into dir+basename, because I can prepare all valid absolute pathnames in advance. Old speed: $ time /usr/lib/rpm/shell.req -v /dev/stdin <<<`rpm -ql rpm-utils |sed -n 's|/usr/bin/||p'` shell.req: add_changelog -> /usr/bin/add_changelog -> rpm-utils (via content index) shell.req: buildreq -> /usr/bin/buildreq -> rpm-utils (via content index) shell.req: cleanup_spec -> /usr/bin/cleanup_spec -> rpm-utils (via content index) shell.req: compare_packages -> /usr/bin/compare_packages -> rpm-utils (via content index) shell.req: filereq -> /usr/bin/filereq -> rpm-utils (via content index) shell.req: packageof -> /usr/bin/packageof -> rpm-utils (via content index) shell.req: packagereq -> /usr/bin/packagereq -> rpm-utils (via content index) shell.req: rebuild_package -> /usr/bin/rebuild_package -> rpm-utils (via content index) shell.req: rebuild_packages -> /usr/bin/rebuild_packages -> rpm-utils (via content index) shell.req: rpmdups -> /usr/bin/rpmdups -> rpm-utils (via content index) shell.req: rpmevrcmp -> /usr/bin/rpmevrcmp -> rpm-utils (via content index) shell.req: rpmrdups -> /usr/bin/rpmrdups -> rpm-utils (via content index) shell.req: rpmvercmp -> /usr/bin/rpmvercmp -> rpm-utils (via content index) shell.req: stamp_spec -> /usr/bin/stamp_spec -> rpm-utils (via content index) rpm-utils /usr/lib/rpm/shell.req -v /dev/stdin <<< 5.37s user 0.11s system 96% cpu 5.683 total $ New speed: $ time /usr/lib/rpm/shell.req -v /dev/stdin <<<`rpm -ql rpm-utils |sed -n 's|/usr/bin/||p'` shell.req: add_changelog -> /usr/bin/add_changelog -> rpm-utils (via content index) shell.req: buildreq -> /usr/bin/buildreq -> rpm-utils (via content index) shell.req: cleanup_spec -> /usr/bin/cleanup_spec -> rpm-utils (via content index) shell.req: compare_packages -> /usr/bin/compare_packages -> rpm-utils (via content index) shell.req: filereq -> /usr/bin/filereq -> rpm-utils (via content index) shell.req: packageof -> /usr/bin/packageof -> rpm-utils (via content index) shell.req: packagereq -> /usr/bin/packagereq -> rpm-utils (via content index) shell.req: rebuild_package -> /usr/bin/rebuild_package -> rpm-utils (via content index) shell.req: rebuild_packages -> /usr/bin/rebuild_packages -> rpm-utils (via content index) shell.req: rpmdups -> /usr/bin/rpmdups -> rpm-utils (via content index) shell.req: rpmevrcmp -> /usr/bin/rpmevrcmp -> rpm-utils (via content index) shell.req: rpmrdups -> /usr/bin/rpmrdups -> rpm-utils (via content index) shell.req: rpmvercmp -> /usr/bin/rpmvercmp -> rpm-utils (via content index) shell.req: stamp_spec -> /usr/bin/stamp_spec -> rpm-utils (via content index) rpm-utils /usr/lib/rpm/shell.req -v /dev/stdin <<< 0.34s user 0.10s system 88% cpu 0.499 total $ More than ten times faster, wow! I didn't know regexp engine could be that slow, really. |
||
---|---|---|
autodeps | ||
build | ||
doc | ||
lib | ||
po | ||
python | ||
rpmdb | ||
rpmio | ||
scripts | ||
tests | ||
tools | ||
.cvsignore | ||
.gear-rules | ||
.lclintrc | ||
ABOUT-NLS | ||
build.c | ||
build.h | ||
CHANGES | ||
config.site | ||
configure.in | ||
COPYING | ||
CREDITS | ||
debug.h | ||
Doxyfile.in | ||
Doxyheader | ||
gendiff | ||
GROUPS | ||
INSTALL | ||
install-sh | ||
installplatform | ||
macros.in | ||
Makefile.am | ||
missing | ||
mkinstalldirs | ||
platform.in | ||
README | ||
README.ALT-ru_RU.KOI8-R | ||
README.amiga | ||
rpm2cpio.c | ||
rpm-4_0.spec | ||
rpm-build.buildreq | ||
RPM-GPG-KEY | ||
RPM-PGP-KEY | ||
rpm.magic | ||
rpm.spec.in | ||
rpminit | ||
rpminit.1 | ||
rpmpopt.in | ||
rpmqv.c | ||
rpmrc.in | ||
system.h | ||
TODO |
This is RPM, the Red Hat Package Manager. The latest releases are always available at: ftp://ftp.rpm.org/pub/rpm Additional RPM documentation (papers, slides, HOWTOs) can also be found at the same site, as well as http://www.rpm.org. There is a mailing list for discussion of RPM issues, rpm-list@redhat.com. To subscribe, send a message to rpm-list-request@redhat.com with the word "subscribe" in the subject line. RPM was originally written by: Erik Troan <ewt@redhat.com> Marc Ewing <marc@redhat.com> See the CREDITS file for a list of folks who have helped us out tremendously. RPM is Copyright (c) 1998 by Red Hat Software, Inc., and may be distributed under the terms of the GPL and LGPL (see the file COPYING for details).