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

Unified Diff: third_party/re2/patches/re2-memory-optimization.patch

Issue 1096813007: third_party/re2: Remove remove-static-initializers.patch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rm the patch files and update the README file Created 5 years, 8 months 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: third_party/re2/patches/re2-memory-optimization.patch
diff --git a/third_party/re2/patches/re2-memory-optimization.patch b/third_party/re2/patches/re2-memory-optimization.patch
deleted file mode 100644
index 05299b396cb415c7150ec25f0c0ae8e8cc6a796c..0000000000000000000000000000000000000000
--- a/third_party/re2/patches/re2-memory-optimization.patch
+++ /dev/null
@@ -1,133 +0,0 @@
-diff --git a/re2/prefilter_tree.cc b/re2/prefilter_tree.cc
---- a/re2/prefilter_tree.cc
-+++ b/re2/prefilter_tree.cc
-@@ -107,21 +107,23 @@ void PrefilterTree::Compile(vector<string>* atom_vec) {
- // not miss out on any regexps triggering by getting rid of a
- // prefilter node.
- for (int i = 0; i < entries_.size(); i++) {
-- IntMap* parents = entries_[i].parents;
-+ StdIntMap* parents = entries_[i].parents;
- if (parents->size() > 8) {
- // This one triggers too many things. If all the parents are AND
- // nodes and have other things guarding them, then get rid of
- // this trigger. TODO(vsri): Adjust the threshold appropriately,
- // make it a function of total number of nodes?
- bool have_other_guard = true;
-- for (IntMap::iterator it = parents->begin(); it != parents->end(); ++it)
-+ for (StdIntMap::iterator it = parents->begin();
-+ it != parents->end(); ++it) {
- have_other_guard = have_other_guard &&
-- (entries_[it->index()].propagate_up_at_count > 1);
-+ (entries_[it->first].propagate_up_at_count > 1);
-+ }
-
- if (have_other_guard) {
-- for (IntMap::iterator it = parents->begin();
-+ for (StdIntMap::iterator it = parents->begin();
- it != parents->end(); ++it)
-- entries_[it->index()].propagate_up_at_count -= 1;
-+ entries_[it->first].propagate_up_at_count -= 1;
-
- parents->clear(); // Forget the parents
- }
-@@ -213,7 +215,7 @@ void PrefilterTree::AssignUniqueIds(vector<string>* atom_vec) {
- }
- entries_.resize(node_map_.size());
-
-- // Create parent IntMap for the entries.
-+ // Create parent StdIntMap for the entries.
- for (int i = v.size() - 1; i >= 0; i--) {
- Prefilter* prefilter = v[i];
- if (prefilter == NULL)
-@@ -223,7 +225,7 @@ void PrefilterTree::AssignUniqueIds(vector<string>* atom_vec) {
- continue;
-
- Entry* entry = &entries_[prefilter->unique_id()];
-- entry->parents = new IntMap(node_map_.size());
-+ entry->parents = new StdIntMap();
- }
-
- // Fill the entries.
-@@ -249,7 +251,7 @@ void PrefilterTree::AssignUniqueIds(vector<string>* atom_vec) {
-
- case Prefilter::OR:
- case Prefilter::AND: {
-- IntMap uniq_child(node_map_.size());
-+ std::set<int> uniq_child;
- for (int j = 0; j < prefilter->subs()->size() ; j++) {
- Prefilter* child = (*prefilter->subs())[j];
- Prefilter* canonical = CanonicalNode(child);
-@@ -258,12 +260,12 @@ void PrefilterTree::AssignUniqueIds(vector<string>* atom_vec) {
- return;
- }
- int child_id = canonical->unique_id();
-- if (!uniq_child.has_index(child_id))
-- uniq_child.set_new(child_id, 1);
-+ uniq_child.insert(child_id);
- // To the child, we want to add to parent indices.
- Entry* child_entry = &entries_[child_id];
-- if (!child_entry->parents->has_index(prefilter->unique_id()))
-- child_entry->parents->set_new(prefilter->unique_id(), 1);
-+ if (child_entry->parents->find(prefilter->unique_id()) ==
-+ child_entry->parents->end())
-+ (*child_entry->parents)[prefilter->unique_id()] = 1;
- }
- entry->propagate_up_at_count =
- prefilter->op() == Prefilter::AND ? uniq_child.size() : 1;
-@@ -329,10 +331,10 @@ void PrefilterTree::PropagateMatch(const vector<int>& atom_ids,
- }
- int c;
- // Pass trigger up to parents.
-- for (IntMap::iterator it = entry.parents->begin();
-+ for (StdIntMap::iterator it = entry.parents->begin();
- it != entry.parents->end();
- ++it) {
-- int j = it->index();
-+ int j = it->first;
- const Entry& parent = entries_[j];
- VLOG(10) << " parent= " << j << " trig= " << parent.propagate_up_at_count;
- // Delay until all the children have succeeded.
-@@ -364,12 +366,12 @@ void PrefilterTree::PrintDebugInfo() {
- VLOG(10) << "#Unique Nodes: " << entries_.size();
-
- for (int i = 0; i < entries_.size(); ++i) {
-- IntMap* parents = entries_[i].parents;
-+ StdIntMap* parents = entries_[i].parents;
- const vector<int>& regexps = entries_[i].regexps;
- VLOG(10) << "EntryId: " << i
- << " N: " << parents->size() << " R: " << regexps.size();
-- for (IntMap::iterator it = parents->begin(); it != parents->end(); ++it)
-- VLOG(10) << it->index();
-+ for (StdIntMap::iterator it = parents->begin(); it != parents->end(); ++it)
-+ VLOG(10) << it->first;
- }
- VLOG(10) << "Map:";
- for (map<string, Prefilter*>::const_iterator iter = node_map_.begin();
-diff --git a/re2/prefilter_tree.h b/re2/prefilter_tree.h
---- a/re2/prefilter_tree.h
-+++ b/re2/prefilter_tree.h
-@@ -16,12 +16,15 @@
- #ifndef RE2_PREFILTER_TREE_H_
- #define RE2_PREFILTER_TREE_H_
-
-+#include <map>
-+
- #include "util/util.h"
- #include "util/sparse_array.h"
-
- namespace re2 {
-
- typedef SparseArray<int> IntMap;
-+typedef std::map<int, int> StdIntMap;
-
- class Prefilter;
-
-@@ -71,7 +74,7 @@ class PrefilterTree {
- // are two different nodes, but they share the atom 'def'. So when
- // 'def' matches, it triggers two parents, corresponding to the two
- // different OR nodes.
-- IntMap* parents;
-+ StdIntMap* parents;
-
- // When this node is ready to trigger the parent, what are the
- // regexps that are triggered.

Powered by Google App Engine
This is Rietveld 408576698