|
[subresource_filter] Replace KMP by std::search.
This CL replaces Knuth-Morris-Pratt algorithm in IndexedRuleset with a naive
string searching algorithm, i.e. base::StringPiece::find/std::search.
This reduces the size of the IndexedRuleset by 500+ kB, because currently that
much space is needed to store failure functions for all the (sub-)patterns.
This also improves performance of IndexedRuleset by 40%, as measured by
stress-testing. This is explained as follows:
* The subresource_filter's patterns are inherently simple. In the worst
case of a URL the matching will make 4-5 comparisons per character.
* The real world URLs are usually not worst-case, and the real average number
drops down to 1-2 comparisons per character.
BUG= 708458
Review-Url: https://codereview.chromium.org/2793993002
Cr-Commit-Position: refs/heads/master@{#462131}
Committed: https://chromium.googlesource.com/chromium/src/+/35d1881dac3470d2ed891feae0c1cfcf30025a0b
Total comments: 17
Total comments: 35
Total comments: 9
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+356 lines, -1173 lines) |
Patch |
 |
M |
components/subresource_filter/core/browser/BUILD.gn
|
View
|
1
2
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
components/subresource_filter/core/browser/ruleset_service_unittest.cc
|
View
|
1
2
3
4
|
2 chunks |
+6 lines, -5 lines |
0 comments
|
Download
|
 |
M |
components/subresource_filter/core/common/BUILD.gn
|
View
|
|
3 chunks |
+1 line, -4 lines |
0 comments
|
Download
|
 |
M |
components/subresource_filter/core/common/flat/rules.fbs
|
View
|
|
1 chunk |
+0 lines, -16 lines |
0 comments
|
Download
|
 |
M |
components/subresource_filter/core/common/fuzzy_pattern_matching.h
|
View
|
1
2
3
4
5
6
|
2 chunks |
+5 lines, -96 lines |
0 comments
|
Download
|
 |
M |
components/subresource_filter/core/common/fuzzy_pattern_matching.cc
|
View
|
1
2
3
4
|
2 chunks |
+21 lines, -0 lines |
0 comments
|
Download
|
 |
M |
components/subresource_filter/core/common/fuzzy_pattern_matching_unittest.cc
|
View
|
1
2
3
4
5
6
|
4 chunks |
+26 lines, -23 lines |
0 comments
|
Download
|
 |
M |
components/subresource_filter/core/common/indexed_ruleset.cc
|
View
|
1
|
7 chunks |
+9 lines, -32 lines |
0 comments
|
Download
|
 |
M |
components/subresource_filter/core/common/indexed_ruleset_unittest.cc
|
View
|
|
2 chunks |
+7 lines, -8 lines |
0 comments
|
Download
|
 |
D |
components/subresource_filter/core/common/knuth_morris_pratt.h
|
View
|
|
1 chunk |
+0 lines, -249 lines |
0 comments
|
Download
|
 |
D |
components/subresource_filter/core/common/knuth_morris_pratt_unittest.cc
|
View
|
|
1 chunk |
+0 lines, -218 lines |
0 comments
|
Download
|
 |
M |
components/subresource_filter/core/common/test_ruleset_creator.h
|
View
|
1
2
3
4
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
components/subresource_filter/core/common/test_ruleset_creator.cc
|
View
|
1
2
3
4
|
3 chunks |
+10 lines, -8 lines |
0 comments
|
Download
|
 |
M |
components/subresource_filter/core/common/test_ruleset_utils.h
|
View
|
1
2
3
4
|
1 chunk |
+5 lines, -0 lines |
0 comments
|
Download
|
 |
M |
components/subresource_filter/core/common/unindexed_ruleset_unittest.cc
|
View
|
|
1 chunk |
+5 lines, -5 lines |
0 comments
|
Download
|
 |
M |
components/subresource_filter/core/common/url_pattern.h
|
View
|
1
2
3
4
|
3 chunks |
+34 lines, -8 lines |
0 comments
|
Download
|
 |
M |
components/subresource_filter/core/common/url_pattern.cc
|
View
|
1
2
3
4
5
6
7
|
2 chunks |
+195 lines, -15 lines |
0 comments
|
Download
|
 |
D |
components/subresource_filter/core/common/url_pattern_matching.h
|
View
|
|
1 chunk |
+0 lines, -277 lines |
0 comments
|
Download
|
 |
D |
components/subresource_filter/core/common/url_pattern_matching_unittest.cc
|
View
|
|
1 chunk |
+0 lines, -152 lines |
0 comments
|
Download
|
 |
A + |
components/subresource_filter/core/common/url_pattern_unittest.cc
|
View
|
1
2
3
|
4 chunks |
+29 lines, -57 lines |
0 comments
|
Download
|
Total messages: 56 (38 generated)
|