From e9185eca390435b4060ef26c7c69d39f994da7a7 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 27 Dec 2015 01:33:38 +0100 Subject: pkgcachegen: Use std::unordered_map instead of std::map std::unordered_map is faster than std::map in our use case, reducing cache generation time by about 10% in my benchmark. --- apt-pkg/pkgcachegen.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg/pkgcachegen.cc') diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 61f7a1124..e7bdc615b 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -1253,7 +1253,7 @@ map_stringitem_t pkgCacheGenerator::StoreString(enum StringType const type, cons { std::string const key(S, Size); - std::map * strings; + std::unordered_map * strings; switch(type) { case MIXED: strings = &strMixed; break; case PKGNAME: strings = &strPkgNames; break; @@ -1262,7 +1262,7 @@ map_stringitem_t pkgCacheGenerator::StoreString(enum StringType const type, cons default: _error->Fatal("Unknown enum type used for string storage of '%s'", key.c_str()); return 0; } - std::map::const_iterator const item = strings->find(key); + std::unordered_map::const_iterator const item = strings->find(key); if (item != strings->end()) return item->second; -- cgit v1.2.3