Use unordered_map in memdbg for performance
authorAndre Heinecke <aheinecke@intevation.de>
Mon, 24 Sep 2018 09:12:00 +0000 (11:12 +0200)
committerAndre Heinecke <aheinecke@intevation.de>
Mon, 24 Sep 2018 09:12:00 +0000 (11:12 +0200)
* src/memdbg.cpp: Use unordered_map for faster lookups.

--
This code can be queried very often so a performance
improvement is nice to have.

src/memdbg.cpp

index cb39e62..02d8172 100644 (file)
 
 #include <gpg-error.h>
 
-#include <map>
+#include <unordered_map>
 #include <string>
 
-std::map <std::string, int> cppObjs;
-std::map <void *, int> olObjs;
-std::map <void *, std::string> olNames;
-std::map <void *, std::string> allocs;
+std::unordered_map <std::string, int> cppObjs;
+std::unordered_map <void *, int> olObjs;
+std::unordered_map <void *, std::string> olNames;
+std::unordered_map <void *, std::string> allocs;
 
 GPGRT_LOCK_DEFINE (memdbg_log);