Which leads to faster browsing, an ad blocker or an edited hosts file?

5

1

I recently came across the MVPS hosts file and became fascinated with the concept of blocking ads upstream from your browser. I don't know much about how quickly adblockers work, nor how quickly the hosts file can operate.

Would I get any noticeable speed boost by using that hosts file and disabling the adblock browser plugin?

EDIT: Just a quick update - I tried it, and it seems to be much quicker with the edited hosts file, if you can tolerate things like this:

enter image description here

This showed up on the Youtube homepage, I'll perform further testing to see if these are particularly prevalent.

Cyclone

Posted 2013-12-09T18:58:12.863

Reputation: 544

You can use edexter which can replace those annoying dns server errors with a 1x1 white pixel. Edexter is basically a local http server that host any requests to localhost 127.0.0.1 with the 1x1 pixel image – Sun – 2014-11-30T07:37:20.380

Hmm... I would say it would depend on the specific implementation of the adblocker. But if it denies the requests to download the ads or redirects them to localhost, then there shouldn't be any noticeable improvements. – Doktoro Reichard – 2013-12-09T19:20:13.620

Even better, don't mess around with your hosts file instead run a local caching DNS server that blocks the domains. – Zoredache – 2013-12-09T20:19:40.213

Answers

5

Blocking via the hosts file is almost certainly going to be faster just because it's much more limited in capability -- basically, you can only block based on hostnames. Ad blocking extensions can implement fine-grained blocking based on URL paths and parameters, as well as many other properties.

Host blocking will also tend to be faster because it's implemented in the operating system using a lower-overhead language (C or C++), compared to a JavaScript-based ad blocking extension.

A reasonably powerful computer probably won't have much of a problem with a real ad blocker, but if you're on a lower-end computer, host blocking could be significantly faster. So overall, you'll just need to test both and see what works best for you.

jjlin

Posted 2013-12-09T18:58:12.863

Reputation: 12 964

I tested it, and I'm definitely getting a boost, even though my computer is pretty quick already. Pages seem to be displaying in a snappier way. – Cyclone – 2013-12-09T19:45:40.037

2

Using Adblock has a negligible impact on startup performance. (+250 milliseconds) Hard statistics on performance while browsing are harder to come by, but I can say anecdotally that it is considerably faster than browsing without any ad blocking method.

The hosts file is almost certainly faster seeing as it is baked into the OS and is doing something quite simple. On the other hand, Adblock probably stops more ads and requires less upkeep. If you have anything like a modern system, I don't think that the difference between the two would be noticeable to human perception. You are better off choosing based on other factors such as which one is easier to use, or blocks more ads.

David

Posted 2013-12-09T18:58:12.863

Reputation: 6 593

Could be a placebo then that browsing feels quicker, I'll have to perform extended testing I suppose – Cyclone – 2013-12-09T19:50:45.703

Indeed, if you don't actually time it, these types types of things are irritatingly hard to measure with any authority. – David – 2013-12-09T19:54:16.700

2

While the hit in performance is negligible for most modern computers, under certain circumstances (old computers, multiple VMs) the memory hit is rather significant.

Using the Adblock Plus extension can add 60MB of memory use per Firefox process, in addition to 4MB per iframe. Under certain edge cases it can use up to 2GB of memory, which is unacceptable even for modern computers. This is not a fault of ABP's coding, and cannot be trivially fixed. https://blog.mozilla.org/nnethercote/2014/05/14/adblock-pluss-effect-on-firefoxs-memory-usage/

This has also been confirmed by the author of Adblock Plus. https://adblockplus.org/blog/on-the-adblock-plus-memory-consumption

The issue mentioned by the author above (Firefox duplicating memory when ABP is used) has not yet been fixed (or even assigned) as the time of writing (Oct 2014).

Anecdotal result: Disabling Adblock Plus on a VM that I am running reduced the memory consumption from ~220MB to ~140MB (assuming a freshly booted VM and Firefox browser loading the same page), which is a significant decrease. Whether it is worth it or not is completely up to your computer requirements.

March Ho

Posted 2013-12-09T18:58:12.863

Reputation: 1 025

2

The fastest is to redirect the domains you wish to block to a web server that will reply with a blank page, this can be done by using a DNS server on your router that will redirect bad host to a blank page and make your computer use your router's DNS server. Having a service servicing a blank page is faster than waiting for the browser to wait for your request to time out and show an error of some sort.

Using ads blocker extensions or on computer hosts file consume resources on your computer that could have been used elsewhere.

Zulgrib

Posted 2013-12-09T18:58:12.863

Reputation: 280