Skip to content

Overview of uBlock's network filtering engine: details

garry-ut99 edited this page May 22, 2024 · 13 revisions

Overview

Overview of uBlock's network filtering engine

Dynamic URL filtering rules

Advantages:

  • Little overhead creating/deleting dynamic URL rules.
  • Precedence over both dynamic filtering rules and static filters.
    • Useful to diagnose/fix in a very narrow way websites broken by either dynamic filtering rules or static filtering.
    • Useful to create override to current dynamic filtering rules or static filtering.
  • A point and click UI for easy management of rules.

Disadvantages:

  • Can only match URLs which "start with".
  • Can't be loaded from a filter list.

Dynamic filtering rules

Advantages:

  • Little overhead creating/deleting dynamic rules.
  • Precedence over static filters.
  • A point and click UI for easy management of rules.

Disadvantages:

  • Rules are broad: whole sites or class of types.
  • Can't be loaded from a filter list.

Static filtering

Advantages:

  • Flexible syntax: from very broad to very narrow targeting, with support of wildcards at any position.
  • Support cosmetic filtering (removal of DOM elements).
  • Can be loaded from a filter list: facilitate community-supported filter lists.
  • Compatibility: can be used in other blockers supporting ABP-compatible filter syntax.

Disadvantages:

Why are rules "dynamic" and filters "static" if both are declarative?

"Static" means it must be "compiled" ahead-of-time before being used, and "dynamic" means it can effortlessly change at runtime:

  • Rules: you can set rules with a simple mouse clicks in the user interface, they are virtually zero overhead to create/remove.
  • Filters: all filters must be all reloaded in memory when adding/removing.
Clone this wiki locally