This research was conducted by Dr. Andrius Aucinas, performance researcher at Brave, and Dr. Ben Livshits, Brave’s Chief Scientist.
We are continuing our series of posts evaluating Brave browser’s performance. This time we look at one aspect that often frustrates web users: the browsers’ memory consumption. Also, the virtue of aggressive blocking. Modern browsers have become fairly streamlined — a standard version of Google Chrome browser barely takes more than 200 MB of memory. However, websites have grown in complexity and resource use, an effect exacerbated by ads and trackers. We discover that Brave delivers an impressive 33% to 66% memory reduction over a vanilla Chrome measured on a browser with a typical number of open tabs.
Methodology
We compared Chrome (v. 71.0.3578.98) running with no blocker, Chrome with AdBlock Plus (v. 3.4.0) as well as uBlock Origin (v. 1.17.0_0), and Brave (v. 0.58.21, with underlying Chromium v. 71.0.3578.98). All extensions were used with default settings, because users tend to stick to defaults. We ran all tests on a powerful macOS laptop, MacBook Pro (2018) with an Intel Core i7 6-core CPU and 32 GB RAM, to ensure that our measurements are not skewed by memory backpressure of the underlying system. We then also verified the results using an older MacBook Air laptop (mid 2012) with a dual-core CPU and 4 GB RAM for a measure that is more representative of an average desktop user.
Although we generally use tools like Web Replay Proxy to eliminate page variations across test runs, such tools have shortcomings when it comes to deterministically replaying non-deterministic content, where we have observed a small number of requests failing. For this study we therefore used live versions of the websites, re-running each experiment several times to check for variance.
Finally, we are huge fans of GDPR in Europe. However, the additional friction of the consent requests does impact the user experience, and the default tracking that happens on the web. To provide a more complete picture, we ran our tests from both a UK business IP address as well as US IP address over VPN (the VPN exit node was hosted in a US region of AWS). Although AWS IP addresses can sometimes be blocked by various publishers to prevent automated web scraping, we did not observe any such cases across our chosen set of sites.
For memory measurements we relied on Chromium’s tracing tools, specifically, browser startup tracing, running the browser with a few flags disabling features that can add variance but which are not important for our tests. What the different options do is primarily disable chromium features that may cause unpredictable behavior, such as updating safe browsing rules in background:
"$BROWSER" \ --user-data-dir=./new-user-profile \ --trace-config-file=./trace.config \ --safebrowsing-disable-auto-update \ --disable-background-networking \ --disable-dev-shm-usage \ --disable-hang-monitor \ --disable-breakpad \ --no-first-run \ --enable-automation \ --no-sandbox
Memory tracing itself is controlled by the contents of trace.config file:
{ "startup_duration": 31, "result_file": "/tmp/trace.json", "trace_config": { "included_categories": ["disabled-by-default-memory-infra"], "excluded_categories": ["*"], "memory_dump_config": { "triggers": [ { "mode": "light", "periodic_interval_ms": 5000 }, { "mode": "detailed", "periodic_interval_ms": 10000 } ] } } }
In essence, this tracing setup disables all other tracing but memory, to minimize overheads of tracing itself, and collects “light” as well as “detailed” memory dumps every 5 and 10 seconds respectively. Periodic memory dumps let us observe how memory changes during the duration of a test instead of providing only a one-off snapshot — important to see in case it peaks earlier in the process.
Finally, we record for 31 seconds (just over the limit to collect 3 detailed memory dumps), giving the browser enough time to load all the pages, run any garbage collection and generally reach “quiescence”. The above illustration provides an example of how memory use grows throughout a single test as rendered by Chromium’s trace viewer (chrome://tracing).
The different colors indicate memory used by individual components (e.g., rendering engine, JS engine, web caches, dynamically allocated memory…), but they add up to total memory used by the browser at a given point in time. Tracing overheads as recorded by the tool itself were between 50 MB and 100 MB — relatively small and varying little across the different configurations.
It is worth noting that we looked at using an automated, Developer Tools Protocol-driven approach for more complex user interaction sequences. However, with that setup, even simple page loads without additional interactions were yielding both much higher memory use numbers and large variations of memory use across subsequent runs. We therefore focused on the simple usage patterns in this case for repeatability.
Top-level memory usage differences
Out of the box Brave uses only slightly more memory than a vanilla Google Chrome due to additional functionality of built-in ad blocking and user rewards, for example. Another built-in extension as we wrote earlier is PDF.js for PDF document rendering instead of Chrome’s PDFium due to its frequent security problems. All in all, when a browser hasn’t loaded any external pages this adds about 70 MB of memory on top of standard Google Chrome, however the cost becomes negligible compared to the savings with just a handful of pages loaded.
Selecting the Benchmarks
The worksets measured in the above figure are collected from a few notoriously bad publishers overloading their sites with ads and trackers, as well as a fairly arbitrary set of articles, documents, and, of course, a weather forecast.
GDPR for Speed
Only one website, latimes.com, did not display when browsing from a UK address due to regulatory issues. While this contributed to the large memory use differences between UK and US versions, a separate measurement with LATimes excluded still showed a 15% difference between UK and US versions on Chrome.
- Well-implemented ad blocking can deliver 33% – 66% memory savings or 500 MB to as much as 1.9 GB across just 10 pages open
- Not all ad blockers are created equal — both Brave and uBlock Origin are much more aggressive than AdBlock Plus with default settings, yielding much higher savings
- Regulation plays a surprisingly big role not only in privacy protection but also performance of the web