mirror of https://github.com/gorhill/uBlock.git
Support loading of benchmark dataset in published versions
New advanced setting: `benchmarkDatasetURL` Default value: `unset` To specify a URL from where the benchmark dataset will be fetched. This allows to launch benchmark operations from within published versions of uBO, rather than from just a locally built version.
This commit is contained in:
parent
4f75a07b9c
commit
b784b7d569
|
@ -42,6 +42,7 @@ const µBlock = (( ) => { // jshint ignore:line
|
||||||
autoUpdateAssetFetchPeriod: 120,
|
autoUpdateAssetFetchPeriod: 120,
|
||||||
autoUpdateDelayAfterLaunch: 180,
|
autoUpdateDelayAfterLaunch: 180,
|
||||||
autoUpdatePeriod: 7,
|
autoUpdatePeriod: 7,
|
||||||
|
benchmarkDatasetURL: 'unset',
|
||||||
blockingProfiles: '11111/#F00 11011/#C0F 11001/#00F 00001',
|
blockingProfiles: '11111/#F00 11011/#C0F 11001/#00F 00001',
|
||||||
cacheStorageAPI: 'unset',
|
cacheStorageAPI: 'unset',
|
||||||
cacheStorageCompression: true,
|
cacheStorageCompression: true,
|
||||||
|
|
|
@ -684,15 +684,18 @@
|
||||||
vAPI.setTimeout(( ) => {
|
vAPI.setTimeout(( ) => {
|
||||||
ttlTimer = undefined;
|
ttlTimer = undefined;
|
||||||
datasetPromise = undefined;
|
datasetPromise = undefined;
|
||||||
}, 60000);
|
}, 5 * 60 * 1000);
|
||||||
|
|
||||||
if ( datasetPromise !== undefined ) {
|
if ( datasetPromise !== undefined ) {
|
||||||
return datasetPromise;
|
return datasetPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const datasetURL = µBlock.hiddenSettings.benchmarkDatasetURL;
|
||||||
|
if ( datasetURL === 'unset' ) {
|
||||||
|
return Promise.reject('No dataset');
|
||||||
|
}
|
||||||
console.info(`Loading benchmark dataset...`);
|
console.info(`Loading benchmark dataset...`);
|
||||||
const url = vAPI.getURL('/assets/requests.json');
|
datasetPromise = µBlock.assets.fetchText(datasetURL).then(details => {
|
||||||
datasetPromise = µBlock.assets.fetchText(url).then(details => {
|
|
||||||
console.info(`Parsing benchmark dataset...`);
|
console.info(`Parsing benchmark dataset...`);
|
||||||
const requests = [];
|
const requests = [];
|
||||||
const lineIter = new µBlock.LineIterator(details.content);
|
const lineIter = new µBlock.LineIterator(details.content);
|
||||||
|
|
|
@ -15,10 +15,6 @@ fi
|
||||||
rm -rf $DES
|
rm -rf $DES
|
||||||
cp -R ./assets $DES/
|
cp -R ./assets $DES/
|
||||||
|
|
||||||
if [ -f ./tmp/requests.json.gz ]; then
|
|
||||||
gunzip -c ./tmp/requests.json.gz > $DES/requests.json
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir $DES/thirdparties
|
mkdir $DES/thirdparties
|
||||||
cp -R ../uAssets/thirdparties/easylist-downloads.adblockplus.org $DES/thirdparties/
|
cp -R ../uAssets/thirdparties/easylist-downloads.adblockplus.org $DES/thirdparties/
|
||||||
cp -R ../uAssets/thirdparties/mirror1.malwaredomains.com $DES/thirdparties/
|
cp -R ../uAssets/thirdparties/mirror1.malwaredomains.com $DES/thirdparties/
|
||||||
|
|
Loading…
Reference in New Issue