Index: lib/matcher.js |
=================================================================== |
--- a/lib/matcher.js |
+++ b/lib/matcher.js |
@@ -506,16 +506,24 @@ |
* @private |
*/ |
_matchesAnyInternal(location, typeMask, docDomain, thirdParty, sitekey, |
specificOnly) |
{ |
let candidates = location.toLowerCase().match(/[a-z0-9%]{3,}/g); |
if (candidates === null) |
candidates = []; |
+ |
+ // The first keyword in a URL is the protocol (usually "https" or "http"). |
+ // This is an outlier: it has hundreds of filters typically, yet it rarely |
+ // ever has a match. We cut down the amount of processing for blocked URLs |
+ // significantly by moving it to the end of the list. |
+ if (candidates.length > 1) |
+ candidates.push(candidates.shift()); |
+ |
candidates.push(""); |
let whitelistHit = null; |
let blacklistHit = null; |
// If the type mask includes no types other than whitelist-only types, we |
// can skip the blacklist. |
if ((typeMask & ~WHITELIST_ONLY_TYPES) != 0) |