Changes between Version 1 and Version 2 of Ticket #6710


Ignore:
Timestamp:
05/30/2018 12:15:17 PM (2 years ago)
Author:
kzar
Comment:

The issue is pretty rough so far, I wasn't sure of all the details, but it seems like the idea has potential. If we could save 4 or 5 meg or memory for our users it would be great.

For reference my test was to add the following to the Filter constructor in lib/filterClasses.js:

window.setTimeout(() =>
{
  if (this.domains)
  {
    for (let domain of this.domains.keys())
    {
      if (domain)
      {
        let count = (window.domainCount[domain] || 0) + 1;
        window.domainCount[domain] = count;
      }
    }
  }
}, 0);

this to the top of lib/filterClasses.js:

window.domainCount = {};

and then once the extension had finished loading I ran this in the background console:

let saving = 0
for (let domain in domainCount)
{
   let count = domainCount[domain] -1;
   saving += count * domain.length;
}

I saw 4865138 characters with EasyList + AA, which I assume are 1 byte each.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6710

    • Property Cc fhd added
  • Ticket #6710 – Description

    v1 v2  
    1313 - I've done a rough test and it seems that with AA and EasyList we might be able to save a bit under 5 megabytes. It would likely be less in practice, since that doesn't take into account the extra data structures etc that we'd need. 
    1414 - We might be able to save more if we're handle subdomains more cleverly, for example we might be able to avoid storing both "foo.example.com" and "example.com". 
     15 - For this idea to help we also need to be careful to avoid holding on to any references to the complete filter text.