rpm-build/lib
Alexey Tourbin d98cab549d set.c: more redesign to avoid extra copying and strlen
This partially reverts what's been introduced with previous commit.
Realize that strlen() must be *only* called when allocating space
for v[].  There is no reason to call strlen() for every Provides
string, since most of them are decoded via the cache hit.

Note, however, that now I have to use the following trick:

        memcmp(str, cur->str, cur->len + 1) == 0

I rely on the fact this works as expected even when str is shorter than
cur->len.  Namely, memcmp must start from lower addresses and stop at
the first difference (i.e. memcmp must not read past the end of str,
possibly except for a few trailing bytes on the same memory page); this
is not specified by the standard, but this is how it must work.

Also, since the cache now stores full decoded values, it is possible to
avoid copying and instead to set the pointer to internal cache memory.
Copying must be performed, however, when the set is to be downsampled.

Note that average Provides set size is around 1024, which corresponds
to base62 string length of about 2K and v[] of 4K.  Saving strlen(2K)
and memcpy(4K) on every rpmsetcmp call is indeed an improvement.

callgrind annotations for "apt-cache unmet", 4.0.4-alt100.27
1,900,016,996  PROGRAM TOTALS
694,132,522  decode_base62_golomb
583,376,772  rpmsetcmp
106,136,459  __GI_strcmp
102,581,178  __GI_strlen
 80,781,386  msort_with_tmp'2
 38,648,490  memcpy
 26,936,309  __GI_strcpy
 26,918,522  regionSwab.clone.2
 21,000,896  _int_malloc
...

callgrind annotations for "apt-cache unmet", this commit (rebuilt in hasher):
1,264,977,497  PROGRAM TOTALS
533,131,492  decode_base62_golomb
230,706,690  rpmsetcmp
 80,781,386  msort_with_tmp'2
 60,541,804  __GI_strlen
 42,518,368  memcpy
 39,865,182  bcmp
 26,918,522  regionSwab.clone.2
 21,841,085  _int_malloc
...
2011-06-16 00:49:41 +04:00
..
.lclintrc re-added .lclintrc and .cvsignore files from CVS 2002-03-25 20:27:37 +00:00
al.c system.h: moved AUTO_REALLOC from depends.h 2011-01-06 03:26:09 +03:00
al.h al.c: removed extra arguments in alAllSatisfiesDepend 2009-10-04 12:44:38 +04:00
closeall.c fixed compilation 2003-11-24 19:20:13 +00:00
cpio.c Added SELinux support 2010-08-24 16:59:07 +00:00
cpio.h Added SELinux support 2010-08-24 16:59:07 +00:00
depends.c system.h: moved AUTO_REALLOC from depends.h 2011-01-06 03:26:09 +03:00
depends.h system.h: moved AUTO_REALLOC from depends.h 2011-01-06 03:26:09 +03:00
formats.c Migrate to new libbeecrypt 2010-08-12 20:41:06 +00:00
fs.c lib/fs.c (getFilesystemList): Drop "/mnt" support 2007-03-27 15:41:38 +00:00
fsm.c Added SELinux support 2010-08-24 16:59:07 +00:00
fsm.h Added SELinux support 2010-08-24 16:59:07 +00:00
getdate.y Initial revision 2002-03-25 20:16:26 +00:00
header_internal.c lib/header_internal.c (headerGetLangs): Fix stupid X<=Y<=Z comparison 2009-09-24 11:36:29 +04:00
header_internal.h header.c: backported headerSetInstance() and headerGetInstance() from rpm.org 2010-08-22 02:16:02 +04:00
header.h header.h: shut up -Wextra warning 2011-01-03 09:52:38 +03:00
Makefile.am spec, lib/Makefile.am: compile and run set.c in -DSELF_TEST mode 2011-06-07 10:50:10 +04:00
manifest.c rpmReadPackageManifest: Fix comments handling 2008-04-08 15:28:53 +00:00
manifest.h Initial revision 2002-03-25 20:16:26 +00:00
misc.c relocated _noDirTokens, compressFilelist, expandFilelist, providePackageNVR from lib to rpmdb 2005-10-15 16:30:13 +00:00
misc.h transaction.c: revamped decideFileFate() akin to filecmp() 2009-03-09 20:11:22 +03:00
order.c removed ancient dependency loop whiteout mechanism (rpm.org) 2011-01-23 02:30:59 +03:00
package.c package.c (readPackageHeaders): use posix_fadvise(2) to disable readahead 2009-05-10 23:32:48 +04:00
poptI.c Added SELinux support 2010-08-24 16:59:07 +00:00
poptK.c sync with rpm4 branch: include local headers 2002-03-25 22:02:39 +00:00
poptQV.c removed --fileid query selector and Filemd5s rpmdb index (rpm.org) 2011-01-22 17:35:13 +03:00
problems.c s/relocateable/relocatable/ (jbj) 2009-03-08 20:12:18 +03:00
psm.c build/files.c (finalizePkg): calculate RPMTAG_SIZE after optimizations 2011-02-05 03:49:54 +03:00
psm.h build/files.c (finalizePkg): calculate RPMTAG_SIZE after optimizations 2011-02-05 03:49:54 +03:00
query.c removed --fileid query selector and Filemd5s rpmdb index (rpm.org) 2011-01-22 17:35:13 +03:00
rpmchecksig.c sync with rpm4 branch: include local headers 2002-03-25 22:02:39 +00:00
rpmcli.h removed _noDirTokens (producing legacy filelist format) 2009-06-17 06:32:18 +04:00
rpminstall.c s/relocateable/relocatable/ (jbj) 2009-03-08 20:12:18 +03:00
rpmlead.c sync with rpm4 branch: include local headers 2002-03-25 22:02:39 +00:00
rpmlead.h Include local headers. 2006-05-15 03:26:57 +04:00
rpmlib.h removed --fileid query selector and Filemd5s rpmdb index (rpm.org) 2011-01-22 17:35:13 +03:00
rpmlibprov.c rpmlibprov.c: added rpmlib(SetVersions) feature 2010-09-11 01:58:23 +04:00
rpmrc.c rpmrc.c (is_pentiumN): Add models with nonzero extended model 2009-12-20 15:06:21 +00:00
set.c set.c: more redesign to avoid extra copying and strlen 2011-06-16 00:49:41 +04:00
set.h set.c: minor cleanup and English fixes 2011-06-14 00:00:54 +04:00
signature.c build/files.c, lib/signature.c: Do not include unused md5.h 2008-11-12 05:29:08 +03:00
signature.h Include local headers. 2006-05-15 03:26:57 +04:00
stringbuf.c Initial revision 2002-03-25 20:16:26 +00:00
stringbuf.h Initial revision 2002-03-25 20:16:26 +00:00
transaction.c Added SELinux support 2010-08-24 16:59:07 +00:00
verify.c verify.c: updated verifyDependencies() for self-conflicting packages 2010-08-22 02:30:13 +04:00