adblock: update 4.5.9-3

- use the GNU regex matchers with gawk >= 5.4;
  gawk 5.4 switched its default regex engine to MinRX, this
  slows down the domain check a lot (~35x slower)
- speed up the tld compression
- readme update

Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
Dirk Brenken committed 2026-10-17 14:34:53 +02:00
1 parent 3a96d5e93a
commit a445a8ba30
3 files changed
+9 -6

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=adblock
PKG_VERSION:=4.5.9
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
+3
View File
@@ -305,6 +305,9 @@ adblock keeps all working data in RAM to avoid unnecessary flash wear. The numbe
* Use firewall‑based DNS redirection: Route DNS queries via nftables to external filtered DNS resolvers and keep only a minimal local blocklist active
* Use compressed swap: install the `zram-swap` package so the kernel can page out cold memory into compressed RAM under pressure (see below)
**Recommendation for slow CPUs**
The top level domain compression (`adb_tld`) is enabled by default and keeps the blocklist compact, but it needs an additional label reversal per feed and an extra pass over the merged blocklist. On slow CPUs this roughly doubles the processing time, while today's curated feeds are largely compressed already and the number of removed entries is small. If the processing time matters more than a slightly smaller blocklist, set `adb_tld=0`. Example: on a 2-core router with the hagezi pro and oisd big feeds the processing time drops from 14.5 to 7.5 seconds, the blocklist grows by 1.3% (~4,700 entries).
**Use compressed swap (zram-swap) on low memory devices**
The simplest way to survive the memory peak during feed processing is to give the kernel a compressed swap device and let it page out cold memory under pressure. The `zram-swap` package sets this up automatically at boot — no scripting, no changes to adblock, and adblock benefits transparently. Because the swap lives in compressed RAM rather than on flash, this incurs no flash wear.
+5 -5
View File
@@ -10,6 +10,7 @@
#
export LC_ALL=C
export PATH="/usr/sbin:/usr/bin:/sbin:/bin"
export GAWK_GNU_MATCHERS=1
adb_enabled="0"
adb_debug="0"
@@ -1428,16 +1429,15 @@ f_tld() {
# a stack of kept parents is needed, as siblings like 'com.foo-bar' sort between 'com.foo' and 'com.foo.sub'
#
if "${adb_awkcmd}" -v allow="${allow}" '
BEGIN { while ((getline line <allow) > 0) del[line] }
BEGIN { FS = "."; while ((getline line <allow) > 0) del[line] }
{
while (sp > 0 && index($0, stk[sp]) != 1) sp--
if (sp > 0 && index($0, stk[sp] ".") == 1) next
stk[++sp] = $0
n = split($0, seg, ".")
dom = seg[1]
dom = $1
if (dom in del) next
for (i = 2; i <= n; i++) {
dom = seg[i] "." dom
for (i = 2; i <= NF; i++) {
dom = $i "." dom
if (dom in del) next
}
print dom