> I have seen the patches. But I could not seen the improvement they bring.

Ah, sorry, my bad, I've not provided enough context. Thanks for the reminder.

As I've said earlier, my goal is to support a use-case of having a
list of ≈400'000 domains in --server and --ipset lists while running
on a low-end OpenWRT router having 64 MiB of RAM (or running similar
code on iPhone VPN app supporting split tunneling). The meta-goal is
to provide one more tool to the software toolset supporting state
censorship circumvention... Russia, China, Iran, Turkmenistan — you
know it. Other projects like Pi-Hole and router-level ad-blockers
might benefit from this code, but it's hard for me to gauge.

I've developed a few patch stacks to achieve the goal:
- cleaning up code to reduce RAM usage with low-hanging fruits like
struct padding elimination. I've observed 30% smaller RSS overhead for
my use-case
- further RSS reduction: domain strings interning to store a domain
duplicated between --server and --ipset just once
- improving startup latency from several seconds to hundreds of
milliseconds inlining qsort()
- trading 1% of RSS for 20x faster domain lookup: replacing bsearch()
with a mix of hash table lookup and binary search
- increase code size a bit and gain a bit more speed using a CPU
cache-aware binary search
- moving those thousands of domains into a mmap()'able read-only trie
file trading a bit of lookup latency for another ~3x memory reduction
- fixing bugs if/when I spot them

Some of these stacks are ready for review, some are at
working-prototype stage, string interning and cache-aware bsearch are
yet to be written.

I've decided to submit all those patch stacks starting with the least
controversial one, fixing a probably-minor security bug and improving
code size a bit.

My goal of this specific submission is to reduce my local patch-stack
to ease further rebasing & merging.

I would be happy to see those patches either merged or declined
explicitly, but it's not up to me to decide. :-)

-- 
WBRBW, Leonid Evdokimov, https://darkk.net.ru tel:+79816800702
PGP: 6691 DE6B 4CCD C1C1 76A0  0D4A E1F2 A980 7F50 FAB2

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

Reply via email to