Live data from Hacker News

AdBlock Plus’s effect on Firefox’s memory usage

blog.mozilla.org

261–270 of 270 posts

Re: AdBlock Plus’s effect on Firefox’s memory usage

#261
post #207
post #91

Earlier quoted context omitted.

Just installed the extension and it seems great. Particularly like the matrix UI for allowing/blocking things. However, I definitely don't want to micromanage things like accepting scripts and cookies for certain sites I use. Is there a way to make it work essentially the same way as AdBlock does? Tried to look in the wiki but didn't find anything.

This! I would like to have AdBlockPlus' UI with httpSwitchboard's backend. So I filed a request to AdBlockPlus to do that: https://issues.adblockplus.org/ticket/488

... and AdBlockPlus developers closed the issue. One of the reasons given: "missing features [of HTTPSB] are an issue [...] (filter groups, hit statistics etc.)". One of their devs adds "They don't support element hiding, which is one of the main causes for the high memory consumption when using Adblock Plus. Neither do they support popup blocking. [...] [T]here still might be some parts where we can learn from HTTPSB. But the main reason that it is faster and uses less memory is that HTTPSB is less powerful."

Re: AdBlock Plus’s effect on Firefox’s memory usage

#262
post #32

Earlier quoted context omitted.

The killer feature of ABP is: no Youtube ads. Is there any other way to achieve that?

`/etc/hosts`-blocking the ads works fine for youtube. See the list at http://someonewhocares.org/hosts/zero/

Doesn't block them here.

Re: AdBlock Plus’s effect on Firefox’s memory usage

#263
post #174
post #60

Earlier quoted context omitted.

I'd tried this in the past but my machine slowed to a crawl. I guess it was to do with the algorithm used for handling the list of hosts (this sounds like a job for a bloom filter). I've just tried the list you provided and it seems to be ok. Will try it for a while to see how I get on.

A quick dive brought me to glibc: seems like everything is done in `resolv/gethnamaddr.c`. Look for `_PATH_HOSTS` mentions: it is defined as "/etc/hosts/". The parsing seems done by the function `gethtent`. However it returns a single `hostent`... I'll try to understand it tonight.

It's a brute-force linear search. _gethtent() returns one line from the hosts file at a time, the loop itself is in _gethtbyname2(). It opens and parses the hosts file every single time. If I were asked to improve this, I'd probably open and parse the file only once, reparsing when the file's been updated, maybe use an on-disk cache file. Second change would be to use a hash table. I don't think anything as sophisticated as a Bloom filter is necessary unless you have truly huge hosts files.

Since gethnamaddr.c appears to be BSD-licensed I'm willing to bet that 99% of all OSs out there (including Windows) are going to have similar if not identical code.

Re: AdBlock Plus’s effect on Firefox’s memory usage

#264
post #174

Earlier quoted context omitted.

A quick dive brought me to glibc: seems like everything is done in `resolv/gethnamaddr.c`. Look for `_PATH_HOSTS` mentions: it is defined as "/etc/hosts/". The parsing seems done by the function `gethtent`. However it returns a single `hostent`... I'll try to understand it tonight.

It's a brute-force linear search. _gethtent() returns one line from the hosts file at a time, the loop itself is in _gethtbyname2(). It opens and parses the hosts file every single time . If I were asked to improve this, I'd probably open and parse the file only once, reparsing when the file's been updated, maybe use an on-disk cache file. Second change would be to use a hash table. I don't think anything as sophisti…

I see. Thank you!

There's a few packages that take a serious approach at adblock-through-hosts-file, including hostsblock[0], linked below. The cost of the systematic linear search is mitigated by the use of a DNS caching daemon, such as dnsmasq or pdnsd.

Indeed a Bloom filter would be overkill, and I'd rather avoid false positives!

0: http://gaenserich.github.io/hostsblock/

Re: AdBlock Plus’s effect on Firefox’s memory usage

#265
post #260
post #248

Earlier quoted context omitted.

If the computer is that old, then the user is an outlier and not the target audience for the modern major browsers. Better off finding a niche browser.

Actually my computer is only four years old, and supports up to 2GB of RAM. It is hard to find a working niche browser when Mozilla and Google are doing everything to make sure the web depends on their behemoths' complexity. They are pushing for the Web Platform. They are constantly adding new features. I used to use Links 2 as my primary browser until about a year or two ago. I would have preferred to keep using it…

What irks me the most about this whole "web must move forward" mentality is that machines that would otherwise be perfectly usable for the sorts of basic tasks one used to be able to do even without these new web technologies (i.e. read email, news, etc.) are being obsoleted and scrapped by people buying newer, much faster hardware --- only to be used just for those same basic tasks again.

Re: AdBlock Plus’s effect on Firefox’s memory usage

#266
post #20

It's not just memory overhead, it is also CPU overhead. One approach is to write the filtering engine from scratch. It is what I did, without looking at ABP's code beforehand in order to ensure a clean slate mind. I didn't get it right the first time, I did spend quite a large amount of time benchmarking, measuring, prototyping, etc. Once I was satisfied I had finally had a solid code base, I went and benchmarked it…

[deleted]

Re: AdBlock Plus’s effect on Firefox’s memory usage

#267

Earlier quoted context omitted.

I did enter an issue 6 months ago to make it color-blind friendly: https://github.com/gorhill/httpswitchboard/issues/52 I know nothing about color-blindness though, so I will need the input of color-blind people. If there is an option to use blue instead of green, would that work?

That would work for some. The best path would be to not solely rely on color for information representation. Add some other visual element, such as a pattern to the color, or a small icon. I'll chime in on the issue.

And even to the extent that color is being used to convey information, don't rely solely on hue, make sure colors are distinguishable by value as well (in the case of text backgrounds, this is sometimes a better option than a pattern).

Re: AdBlock Plus’s effect on Firefox’s memory usage

#268
post #207
post #91

Earlier quoted context omitted.

Just installed the extension and it seems great. Particularly like the matrix UI for allowing/blocking things. However, I definitely don't want to micromanage things like accepting scripts and cookies for certain sites I use. Is there a way to make it work essentially the same way as AdBlock does? Tried to look in the wiki but didn't find anything.

This! I would like to have AdBlockPlus' UI with httpSwitchboard's backend. So I filed a request to AdBlockPlus to do that: https://issues.adblockplus.org/ticket/488

It's not easy to try to fit new code in old code, I empathize completely with that.

This is where I was at an advantage, I was writing new code to fit with new code. There are ideas though that were keys to performance breakthrough which they certainly could borrow.

Re: AdBlock Plus’s effect on Firefox’s memory usage

#269
post #260

Earlier quoted context omitted.

Actually my computer is only four years old, and supports up to 2GB of RAM. It is hard to find a working niche browser when Mozilla and Google are doing everything to make sure the web depends on their behemoths' complexity. They are pushing for the Web Platform. They are constantly adding new features. I used to use Links 2 as my primary browser until about a year or two ago. I would have preferred to keep using it…

What irks me the most about this whole "web must move forward" mentality is that machines that would otherwise be perfectly usable for the sorts of basic tasks one used to be able to do even without these new web technologies (i.e. read email, news, etc.) are being obsoleted and scrapped by people buying newer, much faster hardware --- only to be used just for those same basic tasks again.

Is that really a bad thing though? These old PC's are extremely wasteful with electricity relative to newer ones, so how much money are people really saving? People are so quick to ignore the ongoing costs and obsess over the immediate.

Basic web browsing/word processing is incredibly cheap to do right now in a new PC (sub $200 sans peripherals for the absolute newest hardware). In my opinion, these are machines that will handle web tasks for at least the next 10 years barring some huge shift that I cannot foresee.

Re: AdBlock Plus’s effect on Firefox’s memory usage

#270

Earlier quoted context omitted.

A proxy cannot dynamically interact with the DOM, so it cannot do everything a plugin can. I think the solution is to use better datastructures in the plugin and improve the integratation of the plugin with the browser.

Cloudflare can, somehow...

Probably using Javascript, i.e., same mechanism as AdBlock Plus.
Post reply on HN