Go to file
Alexey Tourbin 5909f93e30 find-package (FindByName): optimized awk script
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.
2007-03-12 15:06:11 +03:00
autodeps adapted pam.req and pam.prov 2007-03-12 15:06:07 +03:00
build build/expression.c (doPrimary): Read closing parenthesis, patch from Michael Schroeder 2007-02-23 00:05:37 +00:00
doc gendiff.1: added OPTIONS (copied from ls.1.gz) 2007-01-24 21:51:45 +03:00
lib lib/query.c: flush query format buffer before listing files (RH#212833, CVE-2006-5466). 2006-11-18 23:17:15 +00:00
po New group: Graphical desktop/Rox (#10268). 2006-11-16 23:38:25 +00:00
python 4.0.4-alt66 2006-05-14 18:21:28 +04:00
rpmdb Include local headers. 2006-05-15 03:26:57 +04:00
rpmio rpmio/rpmrpc.c (Glob): Override gl_stat to allow broken symlinks. 2006-10-04 16:18:09 +00:00
scripts find-package (FindByName): optimized awk script 2007-03-12 15:06:11 +03:00
tests Removed cvsid tags. 2006-05-14 17:05:34 +04:00
tools Removed cvsid tags. 2006-05-14 17:05:34 +04:00
.cvsignore re-added .lclintrc and .cvsignore files from CVS 2002-03-25 20:27:37 +00:00
.gear-rules 4.0.4-alt66 2006-05-14 18:21:28 +04:00
.lclintrc re-added .lclintrc and .cvsignore files from CVS 2002-03-25 20:27:37 +00:00
ABOUT-NLS Initial revision 2002-03-25 20:16:26 +00:00
build.c buildForTarget: add %{?_buildrequires_build} to BUILDREQUIRES 2004-06-27 13:30:56 +00:00
build.h Initial revision 2002-03-25 20:16:26 +00:00
CHANGES assorted backports from 4_0-20030325 2004-02-29 14:14:02 +00:00
config.site Initial revision 2002-03-25 20:16:26 +00:00
configure.in implemented symlinks.req 2007-03-12 15:06:09 +03:00
COPYING Initial revision 2002-03-25 20:16:26 +00:00
CREDITS Initial revision 2002-03-25 20:16:26 +00:00
debug.h Initial revision 2002-03-25 20:16:26 +00:00
Doxyfile.in sync with rpm4 branch: removed popt entries 2002-03-25 20:41:48 +00:00
Doxyheader Initial revision 2002-03-25 20:16:26 +00:00
gendiff gendiff: I guess "||" is somewhat better than "&&" (at least two bytes shorter!) 2007-01-25 00:32:34 +03:00
GROUPS New group: Graphical desktop/Rox (#10268). 2006-11-16 23:38:25 +00:00
INSTALL sync with rpm4 branch: s/redhat/RPM/g 2002-03-25 20:44:16 +00:00
install-sh Initial revision 2002-03-25 20:16:26 +00:00
installplatform Rename athlonxp platform to athlon_xp (#9991). 2006-09-16 21:50:43 +00:00
macros.in Rename athlonxp platform to athlon_xp (#9991). 2006-09-16 21:50:43 +00:00
Makefile.am Link rpm.static with -pthread. 2006-11-17 00:01:44 +00:00
missing updated code to snapshot 2002-06-15 of 4_0 branch 2002-08-03 16:35:14 +00:00
mkinstalldirs Removed cvsid tags. 2006-05-14 17:05:34 +04:00
platform.in find-package: introduced RPM_FINDPACKAGE_PATH, which makes PATH search fully configurable 2007-03-12 15:06:04 +03:00
README Initial revision 2002-03-25 20:16:26 +00:00
README.ALT-ru_RU.KOI8-R platform.in: Change %optflags_kernel to %nil 2006-12-18 17:00:44 +00:00
README.amiga Initial revision 2002-03-25 20:16:26 +00:00
rpm2cpio.c return proper exit code 2003-05-01 12:19:59 +00:00
rpm-4_0.spec implemented symlinks.req 2007-03-12 15:06:09 +03:00
rpm-build.buildreq added rpm-build buildreq filter 2002-10-02 08:35:16 +00:00
RPM-GPG-KEY Initial revision 2002-03-25 20:16:26 +00:00
RPM-PGP-KEY Initial revision 2002-03-25 20:16:26 +00:00
rpm.magic Initial revision 2002-03-25 20:16:26 +00:00
rpm.spec.in Added pentium4 arch support (Raorn, #5259) 2004-10-31 19:08:39 +00:00
rpminit Removed cvsid tags. 2006-05-14 17:05:34 +04:00
rpminit.1 Removed cvsid tags. 2006-05-14 17:05:34 +04:00
rpmpopt.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
rpmqv.c enhanced RPM_SCRIPTS_DEBUG support, implemented debug levels 2007-03-06 17:23:41 +03:00
rpmrc.in rpmrc.in: Use -mtune=i686 instead of -mtune=generic for i[3456]86 2007-01-11 14:34:51 +00:00
system.h fixed compilation warnings 2003-11-24 18:59:03 +00:00
TODO Initial revision 2002-03-25 20:16:26 +00:00

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).