mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-20 01:12:38 +01:00
Add median cost output to dig-snfe
This commit is contained in:
parent
19fb513d52
commit
d41f28fcd8
4
Makefile
4
Makefile
@ -2,7 +2,7 @@
|
|||||||
run_options := $(filter-out $@,$(MAKECMDGOALS))
|
run_options := $(filter-out $@,$(MAKECMDGOALS))
|
||||||
|
|
||||||
.PHONY: all clean test lint chromium firefox npm dig \
|
.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/*/*/*/*)
|
sources := $(wildcard src/* src/*/* src/*/*/* src/*/*/*/*)
|
||||||
platform := $(wildcard platform/* platform/*/*)
|
platform := $(wildcard platform/* platform/*/*)
|
||||||
@ -65,6 +65,8 @@ compare:
|
|||||||
@echo
|
@echo
|
||||||
maxcost:
|
maxcost:
|
||||||
@echo
|
@echo
|
||||||
|
medcost:
|
||||||
|
@echo
|
||||||
mincost:
|
mincost:
|
||||||
@echo
|
@echo
|
||||||
modifiers:
|
modifiers:
|
||||||
|
@ -41,11 +41,12 @@ import { enableWASM, StaticNetFilteringEngine } from './index.js';
|
|||||||
const FLAGS = process.argv.slice(2);
|
const FLAGS = process.argv.slice(2);
|
||||||
const COMPARE = FLAGS.includes('compare');
|
const COMPARE = FLAGS.includes('compare');
|
||||||
const MAXCOST = FLAGS.includes('maxcost');
|
const MAXCOST = FLAGS.includes('maxcost');
|
||||||
|
const MEDCOST = FLAGS.includes('medcost');
|
||||||
const MINCOST = FLAGS.includes('mincost');
|
const MINCOST = FLAGS.includes('mincost');
|
||||||
const MODIFIERS = FLAGS.includes('modifiers');
|
const MODIFIERS = FLAGS.includes('modifiers');
|
||||||
const RECORD = FLAGS.includes('record');
|
const RECORD = FLAGS.includes('record');
|
||||||
const WASM = FLAGS.includes('wasm');
|
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
|
// This maps puppeteer types to WebRequest types
|
||||||
const WEBREQUEST_OPTIONS = {
|
const WEBREQUEST_OPTIONS = {
|
||||||
@ -153,8 +154,14 @@ async function matchRequests(engine, requests) {
|
|||||||
write('data/snfe.maxcost.json', JSON.stringify(costly, null, 2));
|
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 ) {
|
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));
|
write('data/snfe.mincost.json', JSON.stringify(costly, null, 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,13 @@
|
|||||||
"adblock",
|
"adblock",
|
||||||
"trie"
|
"trie"
|
||||||
],
|
],
|
||||||
"author": "Raymond Hill",
|
"author": "Raymond Hill (https://github.com/gorhill)",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
|
"contributors": [
|
||||||
|
"Manish Jethani <code@manishjethani.io>"
|
||||||
|
],
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/gorhill/uBlock/issues"
|
"url": "https://github.com/uBlockOrigin/uBlock-issues/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/gorhill/uBlock#readme",
|
"homepage": "https://github.com/gorhill/uBlock#readme",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
Loading…
Reference in New Issue
Block a user