Add "Ignore generic cosmetic filters" option

Discussion in 'Feature Requests (AdGuard for Windows)' started by Bushido, Aug 13, 2016.

  1. Bushido

    Bushido Member

    Joined:
    May 15, 2016
    Messages:
    154
    Hello,

    it is possible to add this option to ad-blocking function to make Adguard more effecient for low powered devices?
    I saw that your rival ,,uBlock" had implemented this feature.
    Or do you already have this option enabled somwhere in settings?
     
  2. avatar

    avatar Administrator Staff Member Administrator

    Joined:
    Oct 26, 2010
    Messages:
    13,140
    I don't really understand what is the purpose of it? This is a very questionable thing even from the "economy" point of view.

    We'd better add a feature allowing using "optimized" mobile filters versions instead of the huge desktop versions.
    Just like what we did in the browser extension v2.1: https://github.com/AdguardTeam/AdguardBrowserExtension/releases/tag/v2.1.5 (look for "use optimized filters" feature description there).
     
  3. Bushido

    Bushido Member

    Joined:
    May 15, 2016
    Messages:
    154
    It extends battery life for laptops and makes personal computers to use less power. Github user Gorhill came to that conclusion in regards of benchmark tests.
    If laptop battery life is longer then less money is spent for replacing/fixing battery during lifetime.
     
  4. avatar

    avatar Administrator Staff Member Administrator

    Joined:
    Oct 26, 2010
    Messages:
    13,140
    Raymond is not just a github user, he is ublock author:)

    Could you please link these benchmarks?
     
  5. Bushido

    Bushido Member

    Joined:
    May 15, 2016
    Messages:
    154
  6. avatar

    avatar Administrator Staff Member Administrator

    Joined:
    Oct 26, 2010
    Messages:
    13,140
    Ah, so it is "Ignore generic cosmetic filters"! Huh, this is a huge difference, you know.

    This is not the first time I see him creating yet another rarely used checkbox which is equivalent to a single filter rule.

    Anyway, here is a filter rule which will do it for you:
    Code:
    @@|http$generichide
    Also the "battery life" argument is still weird. Even if we take his argument for granted, let's just do a very simple math.

    Average overhead: 500ms per a huge web page.

    How many web pages do you open for an hour? Let's take you're a surfing maniac and open 500 different pages, 10 in a minute, and every page is huge. So, by using that rule, you've spent 250 extra CPU seconds on it. Which, in turn, is equivalent to about 10-20mAh. Old laptop battery is about 2500-4000 mAh. So you have saved about 0.2% - 0.8% of the battery.

    This just does not make any sense.
     
  7. ag_bug_finder

    ag_bug_finder Beta Tester

    Joined:
    May 27, 2014
    Messages:
    1,667
    What does this do exactly?
     
  8. vasily_bagirov

    vasily_bagirov Administrator Staff Member Administrator

    Joined:
    Jul 1, 2014
    Messages:
    6,903
  9. ag_bug_finder

    ag_bug_finder Beta Tester

    Joined:
    May 27, 2014
    Messages:
    1,667
  10. avatar

    avatar Administrator Staff Member Administrator

    Joined:
    Oct 26, 2010
    Messages:
    13,140
    $generichide disables all generic CSS rules for a page. We will soon update our article on the filter rules syntax, there is soo much we should add there.
     
  11. avatar

    avatar Administrator Staff Member Administrator

    Joined:
    Oct 26, 2010
    Messages:
    13,140
    @Bushido

    I'd like to continue my thought about low performance laptops and such.

    We have already faced this low-end devices issue a while ago when we were working on Adguard for Android. Of course, there is a direct link between the number of filter rules applied to a page and the filtering speed. Also low-end Android devices are much slower than even a 10-year old laptop, so performance issues are even more important.

    So, back then we have found a solution for this which won't affect filtering quality. If you tried AG browser extension you may have seen an option (disabled by default) to start sending ad filters usage statistics to us. Thanks to users who volunteered and turned that option on, we now know which filter rules are really used and which are either rarely used or completely redundant.

    Using this data we have provided special "optimized" filters versions (for instance, the size of an optimized English filter is ~40% of the original). If you use AG browser extension, there is an option to switch to "optimized" filters versions.

    So, we may introduce the same switch in AG for Windows/Mac as well. What do you think about this solution?
     
  12. Bushido

    Bushido Member

    Joined:
    May 15, 2016
    Messages:
    154
    This thought sounds very good. I have already enabled this option in AG browser extension. If this feature will be enabled in AG for Windows/Mac as well, then all AG users will be equally treated, This will be another bonus to choose AG for Windows/Mac instead of browser extension.
    If only AG for Windows/Mac (with all the same extension settings integrated) is running, then browsing speed will be much faster. Because if no extension and only AG service, then less memory is used. Right?

    Also, what do you think about this reference:
    ?

    Gorhill noted that Adguard (what inject unconditionally all generic cosmetic filters into every page and frames on a page) will benefit more than uBlock similar solutions. Maybe he meant that uBlock uses only memory via extension, but Adguard uses also via service and a separate program.
     
    Last edited: Aug 19, 2016
  13. SlowMemory

    SlowMemory Beta Tester

    Joined:
    Sep 20, 2015
    Messages:
    475
    It's a clear misunderstanding about Adguard. Adguard has an algorithm of determining what to inject in frames to speed up browsing.
    This is a statement about ublock origin. Also, memory is not the main point of a GitHub user gorhill's argument, according to the user its purpose was to save some cpu time running its way of injecting generic hiding rules, which exists only in ublock.

    The memory point of view is the only part that make sense in your comparison between Adguard and ublock origin, Easylist's generic hiding rules occupy 303KB (https://github.com/easylist/easylist/blob/master/easylist/easylist_general_hide.txt), so you would save this amount of memory, I don't know whether this is considered as a significant amount. I'd say if you use "EasyList without element hiding" which excludes specific hiding rules(https://github.com/easylist/easylist/blob/master/easylist/easylist_specific_hide.txt) as well, which is 577Kb, you can save even more 880Kb of memory. Again this is not related to cpu running time, nor is the main point.
     
    Last edited: Aug 20, 2016
  14. Bushido

    Bushido Member

    Joined:
    May 15, 2016
    Messages:
    154
    Gorhill states now that
    .
    If so, then ignoring generic cosmetic filters is useful mostly with Android mobile phones and Adguard will not benefit this?

    Plus, Gorhill has come to this calculation:
    So in conclusion - gain of ignoring generic cosmetic filters is very small?
     
  15. avatar

    avatar Administrator Staff Member Administrator

    Joined:
    Oct 26, 2010
    Messages:
    13,140
    This is true. However I don't think that it is important. CSS filter memory footprint is about 8-9 MB. Without generic CSS rules it is about 5-6MB.

    We have introduced this option in AG for iOS a while ago and frankly I am not satisfied with the result.

    I mean the gain is small and the lack of the filtering quality is pretty huge.