40 points · by fossislife · 5y ago · 15 comments
1. Use Selenium and the DevTools Protocol to record every URL requested when rendering and executing a website.
2. Add additional automation to randomly select three distinct same-domain URLs from anchor tags on a page.
3. Used the above automation to visit the homepage of each site, and a maximum of three child pages, and recorded all URLs requested for images, script files, and other web resources.
4. Determine which of those URLs would be blocked by the version of EasyList fetched on that day, using Brave's optimized ad-block implementation.
...
We found that the vast majority of EasyList rules are not used when browsing popular websites; 3,268 of 39,198 (~8%) of network and exception rules were used during our crawls (these measurements exclude element rules)."
That doesn't mean that EasyList is not useful for browsing the rest of the internet.
The idea here would be to compile the regex of each rule to an automata (each automata matches a set of strings) and them build a fst out of them (that would map strings to matched rules)
Matching against static, glob and regex patterns. And there is some grouping and filtering so, it's not like every URL gets all 64k patterns matched. And it's possible to pre-compile and group the Regex to get a little faster (lots of framework routers do this)
From my opinion the "web" is so contaminated it's a shorter accept-list than a constantly changing reject-list
A hash table can't be used for this kind of check because it uses patterns, so resources need to be compared on a pattern. Although I'm sure there are special cases, like hash tables of domain names, which cover a large portion rules.