Hi,
the standard for adblocking on rooted Android phones currently is to create a huge /etc/hosts file that redirects known advertiser domains to localhost. This certainly is faster than redirecting everything through a proxy as adblock plus does, but it is still slow because android reads the entire file and compares line by line all the domains for each DNS request and the file tends to have >30.000 entries. This takes about 20ms per request on a SGS5 for a domain that is not contained in the list with the most recent adaway hosts file. It would be much faster to use a sorted hosts file instead and then do a binary search in this file. I've tried that and got a ~100x performance boost - which is noticeable.
Here's my speed results and patches for libc:
Results/discussion: https://github.com/phillipberndt/and...hosts-proposal
Proposed patch for bionic/libc: https://github.com/phillipberndt/and...e-lookup.patch
This certainly isn't something for AOSP, but I wondered if there's an interest among custom ROM devs to integrate this feature, be it with my patch or a different implementation.
the standard for adblocking on rooted Android phones currently is to create a huge /etc/hosts file that redirects known advertiser domains to localhost. This certainly is faster than redirecting everything through a proxy as adblock plus does, but it is still slow because android reads the entire file and compares line by line all the domains for each DNS request and the file tends to have >30.000 entries. This takes about 20ms per request on a SGS5 for a domain that is not contained in the list with the most recent adaway hosts file. It would be much faster to use a sorted hosts file instead and then do a binary search in this file. I've tried that and got a ~100x performance boost - which is noticeable.
Here's my speed results and patches for libc:
Results/discussion: https://github.com/phillipberndt/and...hosts-proposal
Proposed patch for bionic/libc: https://github.com/phillipberndt/and...e-lookup.patch
This certainly isn't something for AOSP, but I wondered if there's an interest among custom ROM devs to integrate this feature, be it with my patch or a different implementation.