From eff0c22e59e65b6b63e854ff41eb091278e05714 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 7 Jan 2016 19:16:23 +0100 Subject: 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. --- apt-pkg/deb/deblistparser.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb/deblistparser.h') 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 #include +#ifdef APT_PKG_EXPOSE_STRING_VIEW +#include +#endif #ifndef APT_8_CLEANER_HEADERS #include @@ -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 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); -- cgit v1.2.3