Live data from Hacker News

How the most popular Chrome extensions affect browser performance

debugbear.com

111–120 of 136 posts

Re: How the most popular Chrome extensions affect browser performance

#111

> The Avira Browser Safety extension contains a website allowlist with 30k+ regular expressions. When the user navigates to a new page Avira checks if the page URL is in that allowlist I wonder who thought that would be a good idea... Sounds like something that could be significantly improved by compiling all patterns into a single statemachine.

FYI: content blockers like uBlock Origin or Ghostery use block lists of tens of thousands of rules as well (can be up to 100k depending on lists enabled) and there are ways to make this matching very efficient[1].

[1] https://news.ycombinator.com/item?id=19175003

Re: How the most popular Chrome extensions affect browser performance

#112

> The Avira Browser Safety extension contains a website allowlist with 30k+ regular expressions. When the user navigates to a new page Avira checks if the page URL is in that allowlist I wonder who thought that would be a good idea... Sounds like something that could be significantly improved by compiling all patterns into a single statemachine.

Yeah, back when I was doing similar matching on a big bunch of regexes, it was vastly faster to match on all of them lumped together in a group with the ‘or’ operator. And I learned of this more than fifteen years ago from a server-side lib that deduced the exact browser from the user-agent: it had a huge regex with various placeholders and a long list of ‘if/elseif’ checks to extract the values.

Re: How the most popular Chrome extensions affect browser performance

#113
post #29

> "DDG Privacy Essentials does a simple object property lookup based on the request domain, an operation that is practically instantaneous" This sounds interesting. A bit of searching is not providing much enlightenment - anyone care to explain in a bit more detail? Also, if it is so fast, why aren't all the filter add-ons doing it?

To add to the excellent answer from Gorhill, you might find this read interesting: https://0x65.dev/blog/2019-12-20/not-all-adblockers-are-born...

It is a deep dive into how modern content blockers work and what kind of rules they have to enforce (they are usually much more complex than simple domains, though).

As a side node, I recently ran a small experiment and found out that around 90% or blocking from Easylist/EasyPrivacy/uBO lists can be done based on domain information only. But of course this leaves a lot of corner cases where sites might break or ads might still show, and ultimately more granularity is needed to address these cases.

Re: How the most popular Chrome extensions affect browser performance

#114

If the author is here, can I suggest testing the Dark Reader extension too?

Here are the test results for Dark Reader: https://www.debugbear.com/chrome-extension-performance-looku...

I also briefly mention it in the section on FCP, explaining why it makes sense for the extension to use render-blocking content scripts. https://www.debugbear.com/blog/2020-chrome-extension-perform...

Re: How the most popular Chrome extensions affect browser performance

#115
Has a browser team ever considered the possibility of creating allowlists for extensions only on certain websites? A native implementation of something like uMatrix that also worked on extensions could help end users at least remove slowdowns on sites they need to be performant.

Re: How the most popular Chrome extensions affect browser performance

#116

It's entertaining that there is yet another area where "running large numbers of regular expressions, known in advance and not changing all that often" over lots of input is performance critical. This was a key driver behind writing Hyperscan ( https://github.com/intel/hyperscan ) which I used to work on when it was primarily used for network security (thousands or tens of thousands of regular expression rules for fi…

This is indeed a performance critical problem, but it is already pretty much solved at this point. If you look at the performance of the most popular content blockers, their decision time is already below fractions of milliseconds. So it does not seem like performance is really an issue anymore.

Re: How the most popular Chrome extensions affect browser performance

#117
post #71

It looks like a lot of the slowness from the slow extensions is from parsing and executing JavaScript. Are there opportunities from the browser side to make extensions faster? It seems like re-parsing the same JS on every pageload is an opportunity for gains from caching, but I'm also wondering about different delivery mechanisms like wasm. Are there security considerations here?

Alternatively, heavy code could be kept in the background script while page-injected scripts only do interaction. This would even employ the JIT properly.

Re: How the most popular Chrome extensions affect browser performance

#118
post #91

Earlier quoted context omitted.

Resetting chrome isn't much of a solution if the underlying problem is botnet affiliation (trojan, rootkit, etc). Should be reasonably easy to shut down all applications and services, and inspect the traffic going through the router for suspicious domains. If you only have a windows machine connected there should only be Microsoft traffic and maybe the router manufacturer. Anything else, and it's probably malicious.

Inspecting your PC's traffic from a sniffer on your PC to find a rootkit seems like a fool's errand. If something has driver / kernel level privileges it can trivially hide such traffic from any sniffer you have running.

Yes, that's why I said to inspect the router's traffic

Re: How the most popular Chrome extensions affect browser performance

#119
post #98

Utterly fascinating article. The main takeaways seem to be that 1) extensions in general wind up massively increasing CPU time (by 5-20x) when loading "example.com", and 2) ad blockers wind up massively reducing CPU time (by 4-20x) when loading a "WCPO news article". Which makes me happy that I use uBlock (edit: Origin, thanks below), and sad that I have to use LastPass. HOWEVER -- I feel like both these metrics are…

> I have to use LastPass. I recently switched from LastPass to 1Password because of the added latency from Lastpass. Lastpass adds about 70ms to first contentful paint on example.com. 1Password, on the other hand, runs after the painting is done so it doesn't block rendering. I polished up a blog draft I had lying around about switching to 1Password: https://joe.schafer.dev/passing-lastpass/ > I'd be much more intere…

[deleted]

Re: How the most popular Chrome extensions affect browser performance

#120
post #112

> The Avira Browser Safety extension contains a website allowlist with 30k+ regular expressions. When the user navigates to a new page Avira checks if the page URL is in that allowlist I wonder who thought that would be a good idea... Sounds like something that could be significantly improved by compiling all patterns into a single statemachine.

Yeah, back when I was doing similar matching on a big bunch of regexes, it was vastly faster to match on all of them lumped together in a group with the ‘or’ operator. And I learned of this more than fifteen years ago from a server-side lib that deduced the exact browser from the user-agent: it had a huge regex with various placeholders and a long list of ‘if/elseif’ checks to extract the values.

Exactly. If your regex engine compiles to a DFA, you can have arbitrary many or clauses with no overhead. It's pretty neat.
Post reply on HN