Brave browser has fully upgraded its Rust-based ad-blocking engine.

Brave browser has fully upgraded its Rust-based ad-blocking engine.

10 months ago
duguying
96 views
Source: brave

Brave browser has completely revamped its Rust-based ad-blocking engine, reducing memory usage by 75%, resulting in longer battery life and a smoother multitasking experience for all users.

Related tags

#brave#浏览器#rust#广告拦截#省电

This is the 36th article in a series introducing the new privacy features of the Brave browser. This article showcases the work of Mikhail Atuchin (Senior Engineer), Pavel Beloborodov (Senior Software Engineer), and Anton Lazarev (Ad Blocking Engineer). The article was written by Shivan Kaul Sahib (VP of Privacy and Security).

Brave browser has undergone a complete overhaul of its Rust-based ad-blocking engine , reducing memory usage by 75%, resulting in longer battery life and a smoother multitasking experience for all users. This upgrade saves approximately 45 MB of memory by default on all platforms (Android, iOS, and desktop), with even greater savings for users who have enabled more ad-blocking lists. These performance improvements are already in Brave v1.85, with further optimizations coming in v1.86.

image.png
A screenshot comparison between Brave browser versions 1.79.118 and 1.85.118 shows that memory consumption decreased from 162 MB to 104 MB.

As announced last June and October, we achieved this significant memory milestone by iteratively refactoring the adblock-rust engine to use the compact and efficient storage format FlatBuffers. This architectural transformation enabled us to migrate the approximately 100,000 default ad-blocking filters from standard, heap-allocated Rust data structures such as Vecs, HashMap, and struct to a specialized, zero-copy binary format.

In the process, we also completed several other key performance optimizations (some of which will be released in version 1.86):

  1. Memory management: Using stack allocation vectors reduced memory allocation by 19% and improved build time by approximately 15%.
  2. Matching speed: By segmenting commonly used regular expression patterns, filter matching performance is improved by 13%.
  3. Resource sharing: Ad-blocking engine instances share resources, saving approximately 2 MB of memory on the desktop.
  4. Storage efficiency: Internal resource storage memory optimization improves efficiency by 30%.

Saving over 45 MB of memory is a significant milestone in browser performance, especially beneficial for mobile devices and older hardware users. Brave already improves web browsing performance by blocking intrusive ads and trackers, and our latest engineering optimizations ensure that the built-in protection is as lightweight as possible without impacting the user experience. Unlike other browsers’ ad blocking, Brave’s ad-blocking engine is built into the browser and maintained by our privacy team. This deep optimization is impossible for extension-based blockers, as they are limited by browser extension APIs and sandboxing mechanisms. It is this native architecture that makes Brave’s ad and tracker blocking completely unaffected by Manifest V3.

This performance improvement is the result of months of in-depth cross-team engineering collaboration between our performance and privacy teams. It marks a significant increase in browser efficiency and ensures that we can continue to provide best-in-class privacy protection for over 100 million users.

More News

Want to see more quality content?

Browse all news