More benchmarking in the 127.0.0.1 vs 0.0.0.0 issue


I’ve done a little more benchmarking in the 127.0.0.1 vs. 0.0.0.0 issue:

<script>var start=new Date();</script>

<script src="http://ad.a8.net/foo.js"></script>
<script src="http://asy.a8ww.net/foo.js"></script>
<script src="http://a9rhiwa.cn/foo.js"></script>
<script src="http://www.a9rhiwa.cn/foo.js"></script>
<script src="http://acezip.net/foo.js"></script>

<script>var stop=new Date(); alert(stop.getTime() - start.getTime());</script>

What this code does, is to try to include javascript files from five sites and measure the time it takes to process these tags. This testcase was selected because current browsers load the scripts synchronously (the reasons being that the loaded script might modify the current document) and also it is a commonly used method for including third-party content (advertisements, gadgets, etc). The result are:

  • Firefox (3.5) showed no difference: the timing always was a couple of milliseconds
  • Internet Explorer (8) and Google Chrome (2.0) showed quite a large difference in favor of 0.0.0.0: when using it, the pages constantly loaded in tens of milliseconds (between 0 and 30), while using 127.0.0.1 meant a page load time closer to a second (between 900 and 1500 milliseconds).
  • Using Opera (9.64) the results were even further apart: the 0.0.0.0 case took ~1 second, while the 127.0.0.1 case took around 25 (!!!) seconds.

All the measurements were repeated multiple times to ensure their validity. The machine used for this test was running Windows XP with all the latest updates and without any webserver. IMHO this is yet an other argument in favor of using 0.0.0.0 instead of 127.0.0.1 when trying to block hosts.

, ,

Leave a Reply

Your email address will not be published. Required fields are marked *