Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce filter list size by using domain popularity, updating encoding, and removing unapplicable rules #587

Merged
merged 12 commits into from
Jan 15, 2025

Conversation

dharb
Copy link
Collaborator

@dharb dharb commented Jan 9, 2025

This PR makes substantial changes to rebuild-filterlist.mjs and compile-filterlist.mjs in an effort to reduce the size of the filter list and ultimately the injected bundle with minimal impact to coverage.

Notable changes:

  • Use Tranco domain popularity data to filter long-tail domain-specific rules (rank 100k+) from relevant easylist cookie lists
  • Encode bundle using Uint32Array instead of Uint8Array

Through these change we're able to reduce the resulting filterlist-engine.ts by over 60% (4.2M -> 1.8M), which should help significantly with performance.

@dharb dharb requested review from muodov and sammacbeth January 9, 2025 22:39
@muodov muodov added minor Increment the minor version when merged performance Improve performance of an existing feature labels Jan 10, 2025
package.json Outdated Show resolved Hide resolved
scripts/rebuild-filterlist.mjs Show resolved Hide resolved
*/
async function rebuildFilterList() {
await loadTrancoList();
await processFilterList('easylist_cookie_specific_uBO.txt');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we call processFilterlist() on all input files, not just "specific" ones?

scripts/rebuild-filterlist.mjs Outdated Show resolved Hide resolved
@dharb dharb merged commit 1db59c6 into main Jan 15, 2025
5 checks passed
@dharb dharb deleted the dharb/lightweight-ez branch January 15, 2025 15:07
@dharb dharb restored the dharb/lightweight-ez branch January 15, 2025 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged performance Improve performance of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants