d98cab549d
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 ... |
||
---|---|---|
.. | ||
.lclintrc | ||
al.c | ||
al.h | ||
closeall.c | ||
cpio.c | ||
cpio.h | ||
depends.c | ||
depends.h | ||
formats.c | ||
fs.c | ||
fsm.c | ||
fsm.h | ||
getdate.y | ||
header_internal.c | ||
header_internal.h | ||
header.h | ||
Makefile.am | ||
manifest.c | ||
manifest.h | ||
misc.c | ||
misc.h | ||
order.c | ||
package.c | ||
poptI.c | ||
poptK.c | ||
poptQV.c | ||
problems.c | ||
psm.c | ||
psm.h | ||
query.c | ||
rpmchecksig.c | ||
rpmcli.h | ||
rpminstall.c | ||
rpmlead.c | ||
rpmlead.h | ||
rpmlib.h | ||
rpmlibprov.c | ||
rpmrc.c | ||
set.c | ||
set.h | ||
signature.c | ||
signature.h | ||
stringbuf.c | ||
stringbuf.h | ||
transaction.c | ||
verify.c |