Opened 15 months ago

#43 new enhancement

Really huge CSS file structure caused by redundant inclusion of nonspecific selectors in all ab2p.css files

Reported by: Steven Smith <s.t.smith@…> Owned by:
Priority: major Component:
Version: 1.4.2 Keywords:
Cc: Project: adblock2privoxy

Description

This is an efficiency request.

The command

stack exec adblock2privoxy -- -p ~/Downloads/adblock2privoxy/privoxy/ -w ~/Downloads/adblock2privoxy/css/ -d 127.0.0.1 https://easylist-downloads.adblockplus.org/easylist.txt

takes the easylist.txt file of size 3 MB and creates a file structure of CSS files of almost a Gigabyte (628 MB).

This issue is compounded as more EasyList? rule sets are added.

The isse arises because every single ab2p.css file contains every single non-specific selector.

This is massively redundant. The size of the file structure could be greatly reduced by creating a single CSS file containing all non-specific selectors and including this file with all domains.

For example, the non-specific selector

##div[id^="dfp-ad-"]

appears in every single CSS file:

find ~/Downloads/adblock2privoxy/css/ -type f -name 'ab2p.css' -exec fgrep -l 'div[id^="dfp-ad-"]' {} ';'

css/ab2p.css
css/ac/ab2p.css
css/ac/solarmovie/ab2p.css
css/ad/ab2p.css
css/ad/bre/ab2p.css
css/ae/ab2p.css
css/ae/adradio/ab2p.css
...

It would be straightforward to set up a separate CSS file for non-specific selector rules like this, then include the CSS file for all domains. This could be accomplished in the file ab2p.system.filter.

If this were done, the CSS file for, say, ./zw/co/zimpapers/ab2p.css would look like

.hbanners,.tsbanners{display:none!important;visibility:hidden!important}

This new CSS file would require less than 100 bytes, in contrast to the current CSS file size of over 8 kilobytes. There would be comparable savings in all /ab2p.css files.

I hope that you have the time resources to make this relatively small but important change -- of all the EasyList? to privacy conversion tools, yours is the only one that has tackled the problem with the most comprehensive and best approach.

Change History (0)

Note: See TracTickets for help on using tickets.