Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache adblock DATs clientside #27161

Open
antonok-edm opened this issue Dec 5, 2022 · 1 comment
Open

Cache adblock DATs clientside #27161

antonok-edm opened this issue Dec 5, 2022 · 1 comment
Assignees
Labels
enhancement feature/shields/adblock Blocking ads & trackers with Shields OS/Android Fixes related to Android browser functionality OS/Desktop

Comments

@antonok-edm
Copy link
Collaborator

We switched adblock lists to be served as plaintext components rather than serialized DATs in brave/brave-core#15077. Loading adblock lists from plaintext is slightly slower than loading from a serialized DAT, although it leaves us the option of serializing them clientside to the newer uncompressed format which can be deserialized significantly faster. As per brave/brave-core#15077:

Performance analysis

Benchmarking adblock-rust on my own computer shows a minor perf impact related to list parsing at startup, of an additional ~56ms or 32% regression for the entire set of default lists. Note that an additional change can allow adblock-rust to cache compiled DATs in uncompressed format after updates, resulting in a significant improvement to engine load time over the current master branch. I've left the caching for a followup to minimize the number of changes in this PR.

The benchmark results below show the engine load times for the current master configuration, the configuration as of this PR, and the configuration with caching, respectively (middle time value is average).

from_dat                 time:   [173.66 ms 174.88 ms 176.32 ms]
from_plaintext           time:   [228.08 ms 230.97 ms 233.52 ms]
from_uncompressed_dat    time:   [46.191 ms 46.777 ms 47.546 ms]

Brave should create a cached adblock DAT whenever lists are modified, and load this on startup to reduce load at browser-launch. Also, there is currently no code in place to prevent pages from loading before the adblock engines are ready, so this is important to help ads be caught on startup.

@cuba
Copy link

cuba commented Mar 4, 2024

Note, this does not cover the iOS side of the work that needs to be done, the iOS side can be found here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature/shields/adblock Blocking ads & trackers with Shields OS/Android Fixes related to Android browser functionality OS/Desktop
Projects
None yet
Development

No branches or pull requests

2 participants