From 71c9e95b223517b5f51c4627f6ad4cce8af0d901 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 13 Jul 2015 16:28:21 +0200 Subject: split-up Dependency struct Having dependency data separated from the link between version/package and the dependency allows use to work on sharing the depdency data a bit as it turns out that many dependencies are in fact duplicates. How many are duplicates various heavily with the sources configured, but for a single Debian release the ballpark is 2 duplicates for each dependency already (e.g. libc6 counts 18410 dependencies, but only 45 unique). Add more releases and the duplicates count only rises to get ~6 for 3 releases. For each architecture a user has configured which given the shear number of dependencies amounts to MBs of duplication. We can cut down on this number, but pay a heavy price for it: In my many releases(3) + architectures(3) test we have a 10% (~ 0.5 sec) increase in cache creationtime, but also 10% less cachesize (~ 10 MB). Further work is needed to rip the whole benefits from this through, so this is just the start. Git-Dch: Ignore --- apt-pkg/pkgcache.h | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'apt-pkg/pkgcache.h') diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 0042eac96..41709eae8 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -139,6 +139,7 @@ class pkgCache /*{{{*/ struct Description; struct Provides; struct Dependency; + struct DependencyData; struct StringItem; struct VerFile; struct DescFile; @@ -226,6 +227,7 @@ class pkgCache /*{{{*/ Description *DescP; Provides *ProvideP; Dependency *DepP; + DependencyData *DepDataP; APT_DEPRECATED StringItem *StringItemP; char *StrP; @@ -310,6 +312,7 @@ struct pkgCache::Header unsigned short VersionSz; unsigned short DescriptionSz; unsigned short DependencySz; + unsigned short DependencyDataSz; unsigned short ProvidesSz; unsigned short VerFileSz; unsigned short DescFileSz; @@ -324,6 +327,7 @@ struct pkgCache::Header map_id_t VersionCount; map_id_t DescriptionCount; map_id_t DependsCount; + map_id_t DependsDataCount; map_fileid_t ReleaseFileCount; map_fileid_t PackageFileCount; map_fileid_t VerFileCount; @@ -711,7 +715,7 @@ struct pkgCache::Description The base of the linked list is pkgCache::Version::DependsList. All forms of dependencies are recorded here including Depends, Recommends, Suggests, Enhances, Conflicts, Replaces and Breaks. */ -struct pkgCache::Dependency +struct pkgCache::DependencyData { /** \brief string of the version the dependency is applied against */ map_stringitem_t Version; @@ -720,21 +724,26 @@ struct pkgCache::Dependency The generator will - if the package does not already exist - create a blank (no version records) package. */ map_pointer_t Package; // Package - /** \brief next dependency of this version */ - map_pointer_t NextDepends; // Dependency - /** \brief next reverse dependency of this package */ - map_pointer_t NextRevDepends; // Dependency - /** \brief version of the package which has the reverse depends */ - map_pointer_t ParentVer; // Version - /** \brief unique sequel ID */ - should_be_map_id_t ID; /** \brief Dependency type - Depends, Recommends, Conflicts, etc */ unsigned char Type; /** \brief comparison operator specified on the depends line If the high bit is set then it is a logical OR with the previous record. */ unsigned char CompareOp; +}; +struct pkgCache::Dependency +{ + map_pointer_t DependencyData; // DependencyData + /** \brief version of the package which has the depends */ + map_pointer_t ParentVer; // Version + /** \brief next reverse dependency of this package */ + map_pointer_t NextRevDepends; // Dependency + /** \brief next dependency of this version */ + map_pointer_t NextDepends; // Dependency + + /** \brief unique sequel ID */ + should_be_map_id_t ID; }; /*}}}*/ // Provides structure /*{{{*/ -- cgit v1.2.3