top | item 46501894

Brave overhauled its Rust adblock engine with FlatBuffers, cutting memory 75%

507 points| skaul | 1 month ago |brave.com

274 comments

order

nicoburns|1 month ago

Brave's adblocking engine is a neat example of open source and the ease of sharing lbraries in Rust. It uses Servo crates (also used by Firefox) to parse CSS and evaluate selectors, and is then itself published as a crate on crates.io where it can be pulled in by others who may want to use it.

wodenokoto|1 month ago

So brave has two CSS engines? One for rendering and one for blocking?

nineteen999|1 month ago

At risk like node/npm with all the supply-chain attacks then?

Or is there something that cargo does to manage it differently (due diligence?).

shatsky|1 month ago

And yet Rust ecosystem practically killed runtime library sharing, didn't it? With this mentality that every program is not a building block of larger system to be used by maintainers but a final product, and is statically linked with concrete dependency versions specified at development time. And then even multiple worker processes of same app can't share common code in memory like this lib, or ui toolkit, multimedia decoders, etc., right?

PS. Actually I'll risk to share my (I'm new to Rust) thoughts about it: https://shatsky.github.io/notes/2025-12-22_runtime-code-shar...

drnick1|1 month ago

I am surprised there does not exist a community fork of Brave yet that strips out all of the commercial stuff (rewards, AI, own updates), making it suitable for inclusion in the repos of mainstream free/libre Linux distros.

w0ts0n|1 month ago

There is quite a lot of costs associated with running a browser (at scale). Brave is looking to offer something that does what you mention called Brave-origin.

Brendan talks about this a bit more here: https://x.com/BrendanEich/status/2006412918783619455

brnt|1 month ago

This. I use Brave because it has a great, fast adblocker and is fast generally. Unticking all the wallet/AI crap upon install is an acceptable price, but if somebody is going to release Braveium I'm going to use it right away.

uyzstvqs|1 month ago

You can disable all of that within seconds. There's no reason for it not to be included because of that, as all the code running on the client is open-source. If distros only shipped software without commercial interests (why even..?), it'd be an unusable mess of barely maintained hobby projects.

And you should really be using https://flathub.org/en/apps/com.brave.Browser

t0lo|1 month ago

You can hide bat with one click as soon as you install brave

rb666|1 month ago

Isn't this what Helium is doing? I have been using it as daily driver for half a year, works a charm. Only would like better 1Password integration.

ipsum2|1 month ago

It's annoying, but Brave makes it pretty easy to remove, so you only have to do it once per installation.

nialv7|1 month ago

162 to 104 is not 75% reduction... Who calculates reduction percentage like that?!

llm_nerd|1 month ago

To be fair, they claim the adblock engine saw a 75% reduction in memory usage, and in the images they're showing the main browser process generally (I assume? I don't use Brave), or which the adblock engine is only a part but had a substantial impact on usage.

jonkoops|1 month ago

"Brave has overhauled its Rust-based adblock engine to reduce memory consumption by 75%"

This only claims that the memory usage of the adblock engine was reduced, not the total memory consumption of the browser.

dmix|1 month ago

I just found out Brave supports Vertical tabs, https://brave.com/blog/vertical-tabs/

I might have to try switching from FF...

j1elo|1 month ago

A great power of Firefox are its add-ons, aren't they? Sidebery [1] has been a solid implementation of vertical tabs since a long time ago. Begore that got popular, Tree Style Tabs [2] was also a very comprehensive solution.

But nowadays, vertical tabs are native since Firefox v136 [3][4], so at least for the basics you won't need an add-on.

[1]: https://addons.mozilla.org/firefox/addon/sidebery/

[2]: https://addons.mozilla.org/firefox/addon/tree-style-tab/

[3]: https://news.ycombinator.com/item?id=41192118

[4]: https://news.ycombinator.com/item?id=43254871

apparent|1 month ago

Do they support nested tabs? Makes visually navigating many tabs so much easier that way.

aaravchen|1 month ago

It does not actually support hierarchical ("tree") tabs natively yet though. They have a placeholder switch for it in the settings.

Dah00n|1 month ago

Firefox has vertical tabs...

FuturisticGoo|1 month ago

Firefox 136 supports vertical tabs though

mocmoc|1 month ago

I haven't seen an ad nor in iOS nor in Mac since I installed brave. The browser, for me , works perfect

HendrikHensen|1 month ago

What were you using before that? I never see any ad in Firefox with uBlock Origin. I can't imagine it's much of a difference experience than with Brave.

hellohihello135|1 month ago

The number of journalists in the US has dropped by something like 80% in the last 20 years. But sure, enjoy your ad free experience!

nosman|1 month ago

I hope that this is the start of developers being conscious of using resources efficiently again, especially in the browser.

The more rust gets written, the better AI will be able to write it for people... I like to be optimistic.

smt88|1 month ago

I think the Rust part of the headline is incidental in this case. The previous version that used more resources was also written in Rust.

quotemstr|1 month ago

> I hope that this is the start of developers being conscious of using resources efficiently again, especially in the browser.

Me too.

> The more rust gets written,

Rust seems neither necessary nor sufficient for getting developers to care about memory efficiency again though.

seemaze|1 month ago

>I hope that this is the start of developers being conscious of using resources efficiently again, especially in the browser.

AI may have forced the hand on this. Users will no longer be able to subsidize software performance with hardware upgrades due to the great DRAM debacle of 2026..

upcoming-sesame|1 month ago

I like Brave but the only thing that keeps me from using it on mobile is the lack of extension. That's why Firefox is my daily driver on Android

Slapping5552|1 month ago

I recently switched over from FF on Android to Brave. It is much faster, and although extensions are missing, it has a bunch of built in features that covered my use case: - Forced Dark mode - Ad blocking

sbt567|1 month ago

Recently I've found Cromite and sure glad I did! Finally I've found my Kiwi browser replacement. It is also feels faster than both Firefox and Brave on Android (though YMMV).

avazhi|1 month ago

And here I am on IOS where Brave but not Firefox can use adblockers.

My fucking god I’m not sure enshittification has ever been so widely dispersed. It’s impossible to have any type of unified set up across different OS/devices currently.

ComputerGuru|1 month ago

Is that 45 MiB per-tab? People are laughing it off, but since each tab is a process these days..

mccr8|1 month ago

Each tab can be a dozen or more processes nowadays, thanks to site isolation.

goku12|1 month ago

Those may be forked copies of the main adblocker process. If so, you'll get the benefit of CoW page deduplication.

pavlov|1 month ago

Is Brave still a front for a cryptocurrency pump-and-dump scheme?

t0lo|1 month ago

Never was.

Dah00n|1 month ago

They could cut it 110%, so my available RAM grew bigger, and I would still not trust them. They have been caught with their hands deep in the cookie jar too many times.

johnebgd|1 month ago

Meanwhile Firefox keeps undoing its own track record. There really is no perfect solution to browsing the web these days.

jhoho|1 month ago

Can you elaborate?

bqmjjx0kac|1 month ago

I'm not sure how impressed I should feel about saving 45 MiB these days.

mhitza|1 month ago

45MiB is for the default adblock setup, and it scales with the more block lists you have enabled.

I'll happily take performance improvements cause most products lack any efficiency care nowadays.

infogulch|1 month ago

Adblock data is accessed on every request; so this is 45 MiB of cpu cache.

db48x|1 month ago

That’s the wrong way to look at it. Improving the performance of a complex piece of software is not something you do in one fell swoop, or even in a dozen smaller steps. It’s a job of compounding many tiny single–digit percentages over years, and of carefully avoiding performance regressions.

ensocode|1 month ago

Be as impressed as you want but I think it is a very good sign that developers are taking care of it, and as this is a free to use product we can always be happy if someone boosts performance no matter how much

hagbard_c|1 month ago

Very, if only because you'd have said I'm not sure how impressed I should be about saving 4.5 MB these days not all that long ago. Remember when emacs was backronymised to 'eight megabytes and constantly swapping'? That was also not all that long ago. Now 8 megabytes is what some pissant JS library takes as part of some miserable npm package used to bellyflop an ad into your browser window.

timeon|1 month ago

> these days

Are you referring to current RAM prices or bloat of numerous Electron apps?

doe88|1 month ago

Why don't Mozilla make or use such engine in its browser? Make something really native for dealing with ads and annoyances. The irony is Brave smartly uses Rust which were forsaken by Mozilla. I know Mozilla seems to have something for ads but honestly I don't even know what it really does, beside its shield icon.

gkbrk|1 month ago

Almost all of Mozilla's money comes from Google, an ad company. Mozilla wouldn't want to bite the hand that feeds them.

viraptor|1 month ago

Because Mozilla is mostly sponsored by Google.

snowram|1 month ago

Because ad blocking isn't provided by default in Firefox. It isn't as opinionated as Brave, for the better and the worse.

rohin15|1 month ago

It's getting harder and harder to main Firefox. Brave's split tab feature is simple but so brilliant.

goku12|1 month ago

The Zen browser - a derivative of Firefox, also supports split tabs (and a lot of others like spaces, vertical tabs and glances). The project seems fairly active and up to date in the past few years.

Izkata|1 month ago

A decade ago there was a Firefox addon called Tile Tabs that could do any number of arbitrary splits. It died along with all the old-style XUL addons.

Dah00n|1 month ago

1. Look for a new browser instead of Firefox that also have a history of being trustworthy.

2. Look at Brave - see 1.

kvemkon|1 month ago

Perhaps it's obvious but I'm missing some (briefly) justification why FlatBuffers was better, not Protobuf/Capnproto/...

apparent|1 month ago

Funny that the iOS update notes don't mention this at all:

> in this release:

> Other enhancements, stability improvements, and security updates

No mention of efficiency, or adblocking whatsoever!

mywittyname|1 month ago

Is the iOS version of Brave actually the same codebase? My understanding is that all browsers on iOS have to wrap Safari, which would explain the release notes. But I could be wrong here, as I don't develop for iOS.

methuselah_in|1 month ago

But why not use Firefox with ublock? Brave is also chrome beneath. If google pulls the plug what is brave or other browsers anyway?

coffeeling|1 month ago

Chromium is still markedly ahead of Firefox on security, especially on mobile.

ReptileMan|1 month ago

Well brave still uses 300MB per tab on linux and almost 700MB per tab on Windows. So they do have a long way in front of them.

tredre3|1 month ago

That's an absolute lie. The entire browser uses around 400MB when a single tab for news.ycombinator.com is open. The tab itself sits at around 35MB. Additional tab increases by the same amount.

https://imgur.com/a/nNA90lk

eYrKEC2|1 month ago

They're crushing it on ad-blocking. I love it for that reason.

VladVladikoff|1 month ago

Is Brave actually a good browser now? Did they rewrite it or something? Last time I looked it was a janky JavaScript mess.

eYrKEC2|1 month ago

The most effective ad blocker I've ever used. With that, it becomes better than chrome, in my opinion. Give it a spin, it's my daily driver for web dev as well ( just chrome debugger)

tredre3|1 month ago

> a janky JavaScript mess.

You might be thinking of Vivaldi. Brave is certainly buggy, but it's not written in Javascript.

bluecalm|1 month ago

It's better Chrome: no ads, faster (because no ads), some nice features on top. What's not to like?

ThierryBuilds|1 month ago

I am curious to know what was the contribution of switching to FlatBuffers in that improvement.

antonok|1 month ago

FlatBuffers was definitely the majority of the improvements here!

On 64-bit systems, pointers themselves can really start to take up a lot of memory (especially if you multiply them across 100k+ adblock filters). Switching to array indices instead of pointers saves a lot of memory that's otherwise wasted when you don't need to address the entire possible memory space.

dowakin|1 month ago

The Brave is the reasons why I can tolerate iphone )

avazhi|1 month ago

Brave also installed a VPN an a VPN service without permission on my Windows machine, and then didn’t disable or remove 3 separate scheduled tasks in Windows Scheduler once I’d uninstalled it. The VPN issue was open for like 8+ months on GitHub too - and at first they denied doing it at all. For all I know it still installs it, but I removed this malware-type shit when this all happened so I couldn’t tell you.

I’ll never trust them again after that.

jorvi|1 month ago

You've commented this three (?) times under this HN post and several times on this site now. Sure seems like you have a bone to pick.

The VPN they installed was disabled and they could not activate it without user interaction. And the only reason they did this is so when you click "activate VPN" in the browser, it works immediately.

On top of that, other businesses employ(ed) similar tricks. For years and years and years, Dropbox on macOS did a very specific hack to give itself more permissions to ease syncing. Hell, Firefox injected ads for Mr. Robot via a surreptitiously installed invisible extension.

Still a boneheaded move by Brave, just like adding their own affiliate link to crypto links (if none were added) to generate extra revenue for the company at no extra cost to the user. But that is even further in the past.

At any rate, they also fund or develop a bunch of anti-ad tech and research and make it open source / publish it. The defaults of Brave protect your privacy much better than Firefox's defaults. And so far, their BAT concept is the only one that is a legitimate alternative to an ad-funded internet.

Brave is everything Mozilla wishes it had become.

awnird|1 month ago

Does Brave actually block ads now? Or does it still replace them with ads for scanmy cryptocurrency?

agosta|1 month ago

Unlike other reply, I do not work at Brave, and I can also confirm that Brave never did that. They do have their own ads but those have always been opt in (you are not opted in by default), and they do pay some small amount of USD in their crypto token for opting in to those - it's pennies. People scoff at the pennies but guess who pays out nothing to show you ads against your will - literally everyone else.

What you may be thinking of was at one point, when you went to a URL (for some URLs), the browser would rewrite the URL to contain their affiliate link. There was blowback for doing that. They quickly removed that/haven't done it since as far as I know

skaul|1 month ago

> Or does it still replace them with ads for scanmy cryptocurrency?

Brave never did that.

Brave blocks third-party ads & trackers by default.

(disclaimer: I lead privacy and adblocking at Brave)

mikkupikku|1 month ago

It's incredible how people can hallucinate nonsense like this out of nothing, simply because their hatred for Brendan Eich drives them insane.

EbNar|1 month ago

This never happened.