Blockchain-based Brave Browser Enhances Ad Blocker Using Rust
Brave Shields, one of the key components to a seamless browsing experience, which protects users’ privacy, was rebuilt with inspiration from uBlock Origin and Ghostery’s ad-blocker engines. The result of this upgrade is an exponential increase in the efficacy of the shields using a new code base developed in Rust, as per a blog post, June 26, 2019.
Improving Online Privacy
Loading the average web page invokes 75 requests, which need to be checked against tens of thousands of rules to optimize the browsing experience.
Even though Brave already had a well-functioning ad blocking mechanism which was heavily optimized in C++, handling requests at above par speed required further upgrades to the browser. The team found that the browsing experience could be further optimized to enhance the ad blocker by roughly 69 times.
As of today, this implementation has been successfully rolled out in the Dev and Nightly versions of Brave.
The recent controversy surrounding Chromium extensions using WebRequest API to inspect and block what it considered to be undesired requests, did not meaningfully affect Brave due to the depth of the latter’s network stack. However, the argument that popular ad-blockers could indeed be more efficient pointed out that Brave could also improve the process.
Key factors that affect processing time include the number of rules that need to be checked before a request is accepted and the complexity of the rule being evaluated.
Using the New Algorithm
The most vital improvement boils down to how quickly the upgrade eliminates any rules that are unlikely to match a request from search. Brave’s new algorithm works kind of like tokenized hashes by limiting the rule evaluation to those that could be a potential match. While this does not generate a single token for such rules, it hashes each positive option as a separate token.
The new algorithm allows requests to be optimized to a level most browsers can only fathom. While Brave’s previous ad blocking mechanism was fast, it was not the optimal method for improving user experience.
By integrating the new and innovative algorithm, Brave can deliver optimized performance by simulating an API, on top of other key features.