Time from page load to page show is slow when using Brave Shields

Hello,

I experience an issue with the performance of the Brave Shields. More specifically, I encounter many pages that load considerably longer when using Brave Shields compared to having Brave Shields turned off or using some other kind of blocking addon.

To recreate the issue, please follow these steps:

On a default installation and configuration of Brave (current stable version) with Shields turned on and no other addons installed, visit for example this page: www.spiegel.de (a major news site from Germany).

You can notice that after the page has loaded (loading circle in tab stops spinning) there is a delay of about 3 seconds before any page content is actually shown. During these 3 seconds, you can already see that the scrollbar of the page works (I can scroll down just fine), but (again) nothing is being rendered.

To compare this, switch off Brave Shields and reload the page. You can see that the page content is displayed instantly, even while the page is being loaded. It just feels way snappier.
You can also try using a blocker like uBlock Origin (and still deactivated Shields) and the page will also render instantly.

I have tried this on both the current version on Windows 10 and MacOS with the current stable version of Brave. There are some other webpages that show this behavior but the one I mentioned shows the most render lag time.

Do you have any idea what could cause these rendering lags?

Thanks!

HI @racer09, welcome to community!

@fanboynz - would you mind taking a look?

There is something else that just came to my mind and might help you looking into this issue:

The default configuration of the Brave Shields is as follows:

  • Cross-site trackers blocked: On
  • Connections upgrade to HTTPS: On
  • Scripts blocked: Off
  • 3rd-party cookes blocked
  • 3rd-party device recognition blocked

With these settings, I experience the issue as described in my initial post.

However, when I turn on “Scripts blocked” the issue vanishes. Therefore, the problem seems to happen when the page that is processed by the Brave Shields contains scripts and scripts blocking is disabled.

Hope this helps & thanks for your support!

Spiegel.de (and other .de sites) use more adservers and trackers than most sites. They also deploy Anti-adblock techniques to counter the users blocking ads.

No quick fix just yet, but when we get support for UBO snippet filters which is being worked on, it should be easier to counter these sites (and make faster to render in the process)

Cool, thanks for the feedback!

Can you elaborate on the details that cause the rendering behavior, i.e., what is the exact reason to delay rendering in the blocking logic when JavaScript is being executed?

Also, I’d love to read about the snippet filters you mentioned. Is there any material or source code that I can look into?

If you see these filters which would help;

https://github.com/uBlockOrigin/uAssets/blob/master/filters/filters.txt#L175

Which would help:
##+js(setInterval-defuser.js, text/css, 10)
##+js(setTimeout-defuser.js, .call(null), 10)
##^script:has-text(Inject=!)

We’ll help when deploy more ubo filters

I did not really understand that reply, but thanks for the pointers.