Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/matcher.js

Issue 29877558: Noissue - Avoid redundant lookup in keyword-by-filter map (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Revert to Patch Set 1 Created Sept. 19, 2018, 6:01 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/matcher.js
===================================================================
--- a/lib/matcher.js
+++ b/lib/matcher.js
@@ -341,18 +341,19 @@
* @param {RegExpFilter} filter
* @returns {boolean}
*/
isSlowFilter(filter)
{
let matcher = (
filter instanceof WhitelistFilter ? this.whitelist : this.blacklist
);
- if (matcher.hasFilter(filter))
- return !matcher.getKeywordForFilter(filter);
+ let keyword = matcher.getKeywordForFilter(filter);
+ if (keyword != null)
+ return !keyword;
return !matcher.findKeyword(filter);
}
/**
* Optimized filter matching testing both whitelist and blacklist matchers
* simultaneously. For parameters see
{@link Matcher#matchesAny Matcher.matchesAny()}.
* @see Matcher#matchesAny
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld