mirror of https://github.com/gorhill/uBlock.git
hopefully better explanation
This commit is contained in:
parent
c49baf7926
commit
bcaa139362
|
@ -1391,11 +1391,20 @@ FilterContainer.prototype.matchString = function(pageDetails, url, requestType,
|
||||||
// or equivalent
|
// or equivalent
|
||||||
// allow = whitelisted || !blacklisted
|
// allow = whitelisted || !blacklisted
|
||||||
|
|
||||||
// Since statistically a hit on a block filter is more likely than a hit
|
// Statistically, hits on a URL in order of likelihood:
|
||||||
// on an allow filter, we test block filters first, and then if and only
|
// 1. No hit
|
||||||
// if there is a hit on a block filter do we test against allow filters.
|
// 2. Hit on a block filter
|
||||||
// This helps performance compared to testing against both classes of
|
// 3. Hit on an allow filter
|
||||||
// filters in the same loop.
|
//
|
||||||
|
// High likelihood of "no hit" means to optimize we need to reduce as much
|
||||||
|
// as possible the number of filters to test.
|
||||||
|
//
|
||||||
|
// Then, because of the order of probabilities, we should test only
|
||||||
|
// block filters first, and test allow filters if and only if there is a
|
||||||
|
// hit on a block filter. Since there is a high likelihood of no hit,
|
||||||
|
// testing allow filter by default is likely wasted work, hence allow
|
||||||
|
// filters are tested *only* if there is a hit on a (unlikely) hit on a
|
||||||
|
// block filter.
|
||||||
|
|
||||||
var pageDomain = pageDetails.pageDomain || '';
|
var pageDomain = pageDetails.pageDomain || '';
|
||||||
var party = requestHostname.slice(-pageDomain.length) === pageDomain ?
|
var party = requestHostname.slice(-pageDomain.length) === pageDomain ?
|
||||||
|
|
Loading…
Reference in New Issue