Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2581)

Unified Diff: components/omnibox/browser/in_memory_url_index_types.h

Issue 2333253002: flat containers prototype (Closed)
Patch Set: Fixing performance bug in insert(It, It) Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/omnibox/browser/in_memory_url_index_types.h
diff --git a/components/omnibox/browser/in_memory_url_index_types.h b/components/omnibox/browser/in_memory_url_index_types.h
index 070ba43bf621896e2bdf4c18ec71ead2678ff4b0..812e8637181537c15f9398d8fc074d5973a7aa86 100644
--- a/components/omnibox/browser/in_memory_url_index_types.h
+++ b/components/omnibox/browser/in_memory_url_index_types.h
@@ -11,6 +11,8 @@
#include <set>
#include <vector>
+#include "base/containers/flat_map.h"
+#include "base/containers/flat_set.h"
#include "base/containers/hash_tables.h"
#include "base/strings/string16.h"
#include "components/history/core/browser/history_types.h"
@@ -69,8 +71,8 @@ TermMatches ReplaceOffsetsInTermMatches(const TermMatches& matches,
// Convenience Types -----------------------------------------------------------
typedef std::vector<base::string16> String16Vector;
-typedef std::set<base::string16> String16Set;
-typedef std::set<base::char16> Char16Set;
+typedef base::flat_set<base::string16> String16Set;
+typedef base::flat_set<base::char16> Char16Set;
typedef std::vector<base::char16> Char16Vector;
// A vector that contains the offsets at which each word starts within a string.
@@ -131,16 +133,15 @@ typedef size_t WordID;
typedef std::map<base::string16, WordID> WordMap;
// A map from character to the word_ids of words containing that character.
-typedef std::set<WordID> WordIDSet; // An index into the WordList.
-typedef std::map<base::char16, WordIDSet> CharWordIDMap;
+typedef base::flat_set<WordID> WordIDSet; // An index into the WordList.
+typedef base::flat_map<base::char16, WordIDSet> CharWordIDMap;
// A map from word (by word_id) to history items containing that word.
typedef history::URLID HistoryID;
-typedef std::set<HistoryID> HistoryIDSet;
+typedef base::flat_set<HistoryID> HistoryIDSet;
typedef std::vector<HistoryID> HistoryIDVector;
-typedef std::map<WordID, HistoryIDSet> WordIDHistoryMap;
-typedef std::map<HistoryID, WordIDSet> HistoryIDWordMap;
-
+typedef base::flat_map<WordID, HistoryIDSet> WordIDHistoryMap;
+typedef base::flat_map<HistoryID, WordIDSet> HistoryIDWordMap;
// Information used in scoring a particular URL.
typedef std::vector<history::VisitInfo> VisitInfoVector;
@@ -174,6 +175,6 @@ struct RowWordStarts {
WordStarts url_word_starts_;
WordStarts title_word_starts_;
};
-typedef std::map<HistoryID, RowWordStarts> WordStartsMap;
+typedef base::flat_map<HistoryID, RowWordStarts> WordStartsMap;
#endif // COMPONENTS_OMNIBOX_BROWSER_IN_MEMORY_URL_INDEX_TYPES_H_

Powered by Google App Engine
This is Rietveld 408576698