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/deb/deblistparser.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/deb/deblistparser.h')
-rw-r--r-- | apt-pkg/deb/deblistparser.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 42111c837..ad134f8e6 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -19,6 +19,9 @@ #include <string> #include <vector> +#ifdef APT_PKG_EXPOSE_STRING_VIEW +#include <apt-pkg/string_view.h> +#endif #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/indexfile.h> @@ -50,7 +53,10 @@ class APT_HIDDEN debListParser : public pkgCacheListParser bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag, unsigned int Type); bool ParseProvides(pkgCache::VerIterator &Ver); - static bool GrabWord(std::string Word,const WordList *List,unsigned char &Out); + +#ifdef APT_PKG_EXPOSE_STRING_VIEW + APT_HIDDEN static bool GrabWord(APT::StringView Word,const WordList *List,unsigned char &Out); +#endif APT_HIDDEN unsigned char ParseMultiArch(bool const showErrors); public: @@ -64,6 +70,9 @@ class APT_HIDDEN debListParser : public pkgCacheListParser virtual std::string Version() APT_OVERRIDE; virtual bool NewVersion(pkgCache::VerIterator &Ver) APT_OVERRIDE; virtual std::string Description(std::string const &lang) APT_OVERRIDE; +#ifdef APT_PKG_EXPOSE_STRING_VIEW + APT::StringView Description(APT::StringView lang); +#endif virtual std::vector<std::string> AvailableDescriptionLanguages() APT_OVERRIDE; virtual MD5SumValue Description_md5() APT_OVERRIDE; virtual unsigned short VersionHash() APT_OVERRIDE; @@ -91,6 +100,14 @@ class APT_HIDDEN debListParser : public pkgCacheListParser bool const &ParseArchFlags, bool const &StripMultiArch, bool const &ParseRestrictionsList); +#ifdef APT_PKG_EXPOSE_STRING_VIEW + APT_HIDDEN static const char *ParseDepends(const char *Start,const char *Stop, + APT::StringView &Package, + APT::StringView &Ver,unsigned int &Op, + bool const ParseArchFlags = false, bool StripMultiArch = true, + bool const ParseRestrictionsList = false); +#endif + APT_PUBLIC static const char *ConvertRelation(const char *I,unsigned int &Op); debListParser(FileFd *File); |