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

Benchmark framework + bug fixes #31

Merged
merged 33 commits into from
Sep 25, 2018
Merged

Benchmark framework + bug fixes #31

merged 33 commits into from
Sep 25, 2018

Conversation

remusao
Copy link
Collaborator

@remusao remusao commented Sep 18, 2018

Disclaimer: most of the changes are actually static assets (filter lists + list of requests used for testing). Fear not!

This PR is the result of implementing a new benchmark framework to keep track of performance and memory consumption (which should allow to avoid regressions and measure improvements) as well as the comparison with other implementations of content blockers.

  • [test] Add tests for matching and Engine based on Alex top 1000 domains
  • [perf] Add bench module to measure performance + memory consumption in Node.js
  • [perf] Avoid string copy in tokenizer
  • [perf] Avoid copy of filters during Engine initialization
  • [perf] Add minified version of bundle using Closure Compiler
  • [fix] Fix network filter option parsing
  • [fix] Fix isAnchoredByHostname in network filter matching
  • [fix] Re-work optimization framework to be easier to understand and extend
    (also fix bugs in incorrect optimizations)
  • [breaking] Engine.match will now return the original filter matching
    the request instead of a pretty-printed version (caveat: when
    optimizations kick-in, the original filter might not be available anymore.)
  • [breaking] Build artifacts are now located in dist folder.
  • Remove dependency to babel and let TypeScript compile to ES3 instead
  • Simplify TypeScript config + make more strict
  • Simplify rollup config
  • Update dependencies
  • Make use of new tldts package for URL parsing
  • Add type definitions in build artifacts to allow the adblocker to be used
    in a TypeScript project, as a library.
  • Update filters list assets + add script to ease future updates.

The output currently looks something like that, and allows to compare the results with previous runs of the benchmarks. They only run in Node.js but in the future it would be a nice addition to make them run in different browsers as well.

adblocker-bench

@remusao remusao added the WIP label Sep 18, 2018
@remusao remusao removed the WIP label Sep 18, 2018
@remusao remusao changed the title Benchmark Benchmark framework + bug fixes Sep 18, 2018
Copy link
Contributor

@zhonghao-cliqz zhonghao-cliqz left a comment

Choose a reason for hiding this comment

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

Very nice work 👍

},
"dependencies": {
"cross-fetch": "2.2.2",
"tldjs": "2.3.1"
"tldts": "^3.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

await tearDown();
}

collectDataset([
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe the list deserves its own file

@remusao remusao merged commit e051c95 into ghostery:master Sep 25, 2018
@remusao remusao deleted the benchmark branch September 5, 2019 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants