diff options
author | Julian Andres Klode <jak@debian.org> | 2016-01-07 19:16:23 +0100 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2016-01-07 19:59:08 +0100 |
commit | eff0c22e59e65b6b63e854ff41eb091278e05714 (patch) | |
tree | 8496b397479c397085bb57dd4756c9113b4e2cbf /apt-pkg/pkgcachegen.h | |
parent | fe7fa47c1141066c89ab3382c318a4b9d00fe249 (diff) |
Switch performance critical code to use APT::StringView
This improves performance of the cache generation on my
ARM platform (4x Cortex A15) by about 10% to 20% from
2.35-2.50 to 2.1 seconds.
Diffstat (limited to 'apt-pkg/pkgcachegen.h')
-rw-r--r-- | apt-pkg/pkgcachegen.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index ac5947c6a..9455f0b7a 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -29,6 +29,9 @@ #if __cplusplus >= 201103L #include <unordered_map> #endif +#ifdef APT_PKG_EXPOSE_STRING_VIEW +#include <apt-pkg/string_view.h> +#endif class FileFd; class pkgSourceList; @@ -79,8 +82,10 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/ std::string PkgFileName; pkgCache::PackageFile *CurrentFile; - bool NewGroup(pkgCache::GrpIterator &Grp,const std::string &Name); - bool NewPackage(pkgCache::PkgIterator &Pkg,const std::string &Name, const std::string &Arch); +#ifdef APT_PKG_EXPOSE_STRING_VIEW + bool NewGroup(pkgCache::GrpIterator &Grp, APT::StringView Name); + bool NewPackage(pkgCache::PkgIterator &Pkg, APT::StringView Name, APT::StringView Arch); +#endif bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List); bool NewFileDesc(pkgCache::DescIterator &Desc,ListParser &List); bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver, @@ -156,15 +161,16 @@ class APT_HIDDEN pkgCacheListParser inline map_stringitem_t WriteString(const std::string &S) {return Owner->WriteStringInMap(S);}; inline map_stringitem_t WriteString(const char *S,unsigned int Size) {return Owner->WriteStringInMap(S,Size);}; - bool NewDepends(pkgCache::VerIterator &Ver,const std::string &Package, const std::string &Arch, - const std::string &Version,uint8_t const Op, +#ifdef APT_PKG_EXPOSE_STRING_VIEW + bool NewDepends(pkgCache::VerIterator &Ver,APT::StringView Package, APT::StringView Arch, + APT::StringView Version,uint8_t const Op, uint8_t const Type); - bool NewProvides(pkgCache::VerIterator &Ver,const std::string &PkgName, - const std::string &PkgArch, const std::string &Version, + bool NewProvides(pkgCache::VerIterator &Ver,APT::StringView PkgName, + APT::StringView PkgArch, APT::StringView Version, uint8_t const Flags); - bool NewProvidesAllArch(pkgCache::VerIterator &Ver, std::string const &Package, - std::string const &Version, uint8_t const Flags); - + bool NewProvidesAllArch(pkgCache::VerIterator &Ver, APT::StringView Package, + APT::StringView Version, uint8_t const Flags); +#endif public: // These all operate against the current section |