From 49521f87851089bdb4097b715d09a8bd348aa60a Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 28 Sep 2016 00:49:45 +0200 Subject: Do not use MD5SumValue for Description_md5() Our profile says we spend about 5% of the time transforming the hex digits into the binary format used by HashsumValue, all for comparing them against the other strings. That makes no sense at all. According to callgrind, this reduces the overall instruction count from 5,3 billion to 5 billion in my example, which roughly matches the 5%. --- apt-pkg/deb/deblistparser.h | 5 ++++- 1 file changed, 4 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 43ce0cfd3..3d5065953 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -45,6 +45,7 @@ class APT_HIDDEN debListParser : public pkgCacheListParser private: std::vector forceEssential; std::vector forceImportant; + std::string MD5Buffer; protected: pkgTagFile Tags; @@ -74,7 +75,9 @@ class APT_HIDDEN debListParser : public pkgCacheListParser #endif virtual bool NewVersion(pkgCache::VerIterator &Ver) APT_OVERRIDE; virtual std::vector AvailableDescriptionLanguages() APT_OVERRIDE; - virtual MD5SumValue Description_md5() APT_OVERRIDE; +#ifdef APT_PKG_EXPOSE_STRING_VIEW + virtual APT::StringView Description_md5() APT_OVERRIDE; +#endif virtual unsigned short VersionHash() APT_OVERRIDE; virtual bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver) APT_OVERRIDE; virtual bool UsePackage(pkgCache::PkgIterator &Pkg, -- cgit v1.2.3