dump_syms: use unordered_set<> instead of set<> for speed.

dump_syms spends a lot of time trying to compare strings.
This change speeds up processing of libwebviewchromium.so by 30% on my linux
machine.

Patch by Junichi Uekawa <uekawa@chromium.org>

Review URL: https://breakpad.appspot.com/2714002/


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1341 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
mark@chromium.org 2014-06-26 12:37:15 +00:00
parent 9d62ef9311
commit ada265ebbd

View file

@ -46,7 +46,7 @@
#include <stdio.h> #include <stdio.h>
#include <algorithm> #include <algorithm>
#include <set> #include <tr1/unordered_set>
#include <utility> #include <utility>
#include "common/dwarf_line_to_module.h" #include "common/dwarf_line_to_module.h"
@ -55,8 +55,8 @@ namespace google_breakpad {
using std::map; using std::map;
using std::pair; using std::pair;
using std::set;
using std::sort; using std::sort;
using std::tr1::unordered_set;
using std::vector; using std::vector;
// Data provided by a DWARF specification DIE. // Data provided by a DWARF specification DIE.
@ -118,7 +118,7 @@ struct DwarfCUToModule::FilePrivate {
// so this set will actually hold yet another copy of the string (although // so this set will actually hold yet another copy of the string (although
// everything will still work). To improve memory consumption portably, // everything will still work). To improve memory consumption portably,
// we will probably need to use pointers to strings held in this set. // we will probably need to use pointers to strings held in this set.
set<string> common_strings; unordered_set<string> common_strings;
// A map from offsets of DIEs within the .debug_info section to // A map from offsets of DIEs within the .debug_info section to
// Specifications describing those DIEs. Specification references can // Specifications describing those DIEs. Specification references can
@ -337,7 +337,7 @@ void DwarfCUToModule::GenericDIEHandler::ProcessAttributeReference(
} }
string DwarfCUToModule::GenericDIEHandler::AddStringToPool(const string &str) { string DwarfCUToModule::GenericDIEHandler::AddStringToPool(const string &str) {
pair<set<string>::iterator, bool> result = pair<unordered_set<string>::iterator, bool> result =
cu_context_->file_context->file_private_->common_strings.insert(str); cu_context_->file_context->file_private_->common_strings.insert(str);
return *result.first; return *result.first;
} }