diff --git a/Makefile b/Makefile index 08aa75eaa..35fd4e7b5 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ run_options := $(filter-out $@,$(MAKECMDGOALS)) .PHONY: all clean test lint chromium firefox npm dig \ - compare maxcost mincost modifiers record wasm + compare maxcost medcost mincost modifiers record wasm sources := $(wildcard src/* src/*/* src/*/*/* src/*/*/*/*) platform := $(wildcard platform/* platform/*/*) @@ -65,6 +65,8 @@ compare: @echo maxcost: @echo +medcost: + @echo mincost: @echo modifiers: diff --git a/platform/dig/snfe.js b/platform/dig/snfe.js index d226dcb63..789924ac7 100644 --- a/platform/dig/snfe.js +++ b/platform/dig/snfe.js @@ -41,11 +41,12 @@ import { enableWASM, StaticNetFilteringEngine } from './index.js'; const FLAGS = process.argv.slice(2); const COMPARE = FLAGS.includes('compare'); const MAXCOST = FLAGS.includes('maxcost'); +const MEDCOST = FLAGS.includes('medcost'); const MINCOST = FLAGS.includes('mincost'); const MODIFIERS = FLAGS.includes('modifiers'); const RECORD = FLAGS.includes('record'); const WASM = FLAGS.includes('wasm'); -const NEED_RESULTS = COMPARE || MAXCOST || MINCOST || RECORD; +const NEED_RESULTS = COMPARE || MAXCOST || MEDCOST || MINCOST || RECORD; // This maps puppeteer types to WebRequest types const WEBREQUEST_OPTIONS = { @@ -153,8 +154,14 @@ async function matchRequests(engine, requests) { write('data/snfe.maxcost.json', JSON.stringify(costly, null, 2)); } + if ( MEDCOST ) { + const median = results.length >>> 1; + const costly = results.slice().sort((a,b) => b[1].t - a[1].t).slice(median - 500, median + 500); + write('data/snfe.medcost.json', JSON.stringify(costly, null, 2)); + } + if ( MINCOST ) { - const costly = results.slice().sort((a,b) => a[1].t - b[1].t).slice(0, 1000); + const costly = results.slice().sort((a,b) => b[1].t - a[1].t).slice(-1000); write('data/snfe.mincost.json', JSON.stringify(costly, null, 2)); } } diff --git a/platform/npm/package.json b/platform/npm/package.json index 106bcaf0c..774b32a37 100644 --- a/platform/npm/package.json +++ b/platform/npm/package.json @@ -21,10 +21,13 @@ "adblock", "trie" ], - "author": "Raymond Hill", + "author": "Raymond Hill (https://github.com/gorhill)", "license": "GPL-3.0-or-later", + "contributors": [ + "Manish Jethani " + ], "bugs": { - "url": "https://github.com/gorhill/uBlock/issues" + "url": "https://github.com/uBlockOrigin/uBlock-issues/issues" }, "homepage": "https://github.com/gorhill/uBlock#readme", "engines": {