Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Nano Adblocker is spending > 70ms during requestAnimationFrame #311

Closed
jrmuizel opened this issue Mar 2, 2020 · 7 comments
Closed

Nano Adblocker is spending > 70ms during requestAnimationFrame #311

jrmuizel opened this issue Mar 2, 2020 · 7 comments
Labels
archived This thread was archived, open new issues for similar problems. invalid

Comments

@jrmuizel
Copy link

jrmuizel commented Mar 2, 2020

Nano Adblocker is spending > 70ms during requestAnimationFrame. This will have a very negative impact on performance.

Here's a link to a profile showing the problem: https://perfht.ml/32Hyqxo

@jrmuizel
Copy link
Author

jrmuizel commented Mar 2, 2020

The bulk of the time is spent doing selector matching on a bunch of selectors.

@jspenguin2017
Copy link
Member

jspenguin2017 commented Mar 2, 2020

Can't reproduce, you need to fill the template.

@jrmuizel
Copy link
Author

jrmuizel commented Mar 3, 2020

The user that made the profile says that it was on facebook or reddit. I've asked for more details.

@jspenguin2017
Copy link
Member

jspenguin2017 commented Mar 3, 2020

I tested Facebook on my four years old tablet, the animation frame handler takes up to 15 ms. Note that this only happen from time to time, and not every animation frame. The website runs pretty smoothly.

image

@jspenguin2017
Copy link
Member

I am going to close this since you did not fill the template. Keep in mind that I do not maintain the Firefox build. If you can reproduce the issue on Chrome, feel free to open another issue with completed template and detailed reproduction steps.

@gorhill
Copy link

gorhill commented Mar 6, 2020

@jrmuizel

From what I can see, the bulk of the time is spent enforcing procedural cosmetic filters. The user would need to disclose what are these procedural cosmetic filters -- filter list authors are aware that these sort of filters have to be used parsimoniously. Facebook's site however makes it difficult for content blockers to do their job and last time the site required the use of complex procedural filters.

Also, the procedural cosmetic filters code will disable procedural cosmetic filters which are found to be performance bottleneck. As per profiling, the procedural filters uses 1,332 / 20,000ms or ~6.5%, probably below the threshold of what is considered a performance bottleneck.

Now for the specific profiling results you shared, we really need more information as to how the user configured his content blocker (which is essentially at its core uBlock Origin) -- I don't think it's normal for the code to spend so much time in querySelectorAll() -- this suggests some bad filters are being in use. For instance, when I expand Element.querySelectorAll in the profiler, I see a lot of entries like so:

a

These are not part of the default filter lists, and this suggests the user created too many procedural filters.

@gorhill
Copy link

gorhill commented May 20, 2020

Related bugzilla issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1633409.

@github-actions github-actions bot added the archived This thread was archived, open new issues for similar problems. label Aug 21, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Aug 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This thread was archived, open new issues for similar problems. invalid
Projects
None yet
Development

No branches or pull requests

3 participants