summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcachegen.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-09-27 18:59:11 +0200
committerJulian Andres Klode <jak@debian.org>2016-11-22 22:58:19 +0100
commitf378b41f9ab2493bcbc5892d482b18826b0b84c0 (patch)
tree70f6a9235860f9f04b1b55b110e5412f1c601037 /apt-pkg/pkgcachegen.cc
parentf903069c139df58d1ba855f7cf02c4a2d4e51dc3 (diff)
Compare size before data when ordering cache bucket entries
This has the effect of significantly reducing actual string comparisons, and should improve the performance of FindGrp a bit, although it's hardly measureable (callgrind says it uses 10% instructions less now).
Diffstat (limited to 'apt-pkg/pkgcachegen.cc')
-rw-r--r--apt-pkg/pkgcachegen.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index f0b5a982e..1d997678c 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -568,7 +568,7 @@ bool pkgCacheGenerator::NewGroup(pkgCache::GrpIterator &Grp, StringView Name)
unsigned long const Hash = Cache.Hash(Name);
map_pointer_t *insertAt = &Cache.HeaderP->GrpHashTableP()[Hash];
- while (*insertAt != 0 && Name.compare(Cache.ViewString((Cache.GrpP + *insertAt)->Name)) > 0)
+ while (*insertAt != 0 && StringViewCompareFast(Name, Cache.ViewString((Cache.GrpP + *insertAt)->Name)) > 0)
insertAt = &(Cache.GrpP + *insertAt)->Next;
Grp->Next = *insertAt;
*insertAt = Group;
@@ -616,7 +616,7 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg, StringView Name,
// Insert it into the hash table
map_id_t const Hash = Cache.Hash(Name);
map_pointer_t *insertAt = &Cache.HeaderP->PkgHashTableP()[Hash];
- while (*insertAt != 0 && Name.compare(Cache.StrP + (Cache.GrpP + (Cache.PkgP + *insertAt)->Group)->Name) > 0)
+ while (*insertAt != 0 && StringViewCompareFast(Name, Cache.ViewString((Cache.GrpP + (Cache.PkgP + *insertAt)->Group)->Name)) > 0)
insertAt = &(Cache.PkgP + *insertAt)->NextPackage;
Pkg->NextPackage = *insertAt;
*insertAt = Package;