From 2171f774be4c06664c5d2a0c1b8ef1f8b870ffdb Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Sat, 17 May 2008 08:52:19 -0400 Subject: [PATCH] make the mod_cu_function_cache a hash_map instead of map for more go-go --- ChangeLog | 5 +++++ tapsets.cxx | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 24fa8e3bd..139ae6ac6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-05-17 Frank Ch. Eigler + + * tapsets.cxx (cu_function_cache_t): Switch to s, + since these tables tend to get pretty big. + 2008-05-16 Frank Ch. Eigler PR 5643 diff --git a/tapsets.cxx b/tapsets.cxx index 96a930190..c8f77fdea 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -54,6 +55,7 @@ extern "C" { #endif using namespace std; +using namespace __gnu_cxx; // ------------------------------------------------------------------------ @@ -535,8 +537,12 @@ module_cache }; typedef struct module_cache module_cache_t; -typedef map cu_function_cache_t; -typedef map mod_cu_function_cache_t; // module:cu -> function -> die +struct stringhash { + size_t operator() (const string& s) const { hash h; return h(s.c_str()); } +}; + +typedef hash_map cu_function_cache_t; +typedef hash_map mod_cu_function_cache_t; // module:cu -> function -> die struct symbol_table @@ -2491,7 +2497,7 @@ dwflpp::iterate_over_functions (int (* callback)(Dwarf_Die * func, void * arg), string subkey = q->function; if (v->find(subkey) != v->end()) { - Dwarf_Die die = v->at(subkey); + Dwarf_Die die = v->find(subkey)->second; if (q->sess.verbose > 4) clog << "function cache " << key << " hit " << subkey << endl; return (*callback)(& die, data); -- 2.43.5