1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 04:49:12 +02:00

clarify which trie version is used in benchmark for large set

This commit is contained in:
Raymond Hill 2018-12-04 13:32:35 -05:00
parent 9946267f93
commit b548fa4318
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -153,37 +153,34 @@ function initBenchmarks() {
};
var bms = new Benchmark.Suite();
bms
.add(' - Set-based', function() {
dicts = createDict(setBasedDictCreate);
})
.add(' - Trie-based (JS)', function() {
hnBigTrieJS.reset();
dicts = createDict(trieBasedDictCreateJS);
})
.add(' - Trie-based (WASM)', function() {
bms.add(' - Set-based', function() {
dicts = createDict(setBasedDictCreate);
}).add(' - Trie-based JS (3rd-gen)', function() {
hnBigTrieJS.reset();
dicts = createDict(trieBasedDictCreateJS);
});
if ( hnBigTrieWASM.addWASM !== null ) {
bms.add(' - Trie-based WASM (3rd-gen)', function() {
hnBigTrieWASM.reset();
dicts = createDict(trieBasedDictCreateWASM);
})
.add(' - Trie-based (unserialized)', function() {
hnBigTrieJS.reset();
hnBigTrieJS.unserialize(bigTrieDictsSerialized);
})
.on('start', function() {
hnBigTrieJS.reset();
createDict(trieBasedDictCreateJS);
bigTrieDictsSerialized = hnBigTrieJS.serialize();
stdout(gWhich, '');
stdout(gWhich, 'Create dictionaries\n');
})
.on('cycle', function(event) {
stdout(gWhich, String(event.target) + '\n');
})
.on('complete', function() {
dicts = [];
bigTrieDictsSerialized = undefined;
exitBenchmark();
});
});
}
bms.add(' - Trie-based unserialized (3rd-gen)', function() {
hnBigTrieJS.reset();
hnBigTrieJS.unserialize(bigTrieDictsSerialized);
}).on('start', function() {
hnBigTrieJS.reset();
createDict(trieBasedDictCreateJS);
bigTrieDictsSerialized = hnBigTrieJS.serialize();
stdout(gWhich, '');
stdout(gWhich, 'Create dictionaries\n');
}).on('cycle', function(event) {
stdout(gWhich, String(event.target) + '\n');
}).on('complete', function() {
dicts = [];
bigTrieDictsSerialized = undefined;
exitBenchmark();
});
return bms;
})());
@ -207,17 +204,17 @@ function initBenchmarks() {
}
};
bms
.add(' - Set-based', function() {
lookupDict(setDicts, setBasedDictTest);
})
.add(' - Trie-based JS', function() {
lookupDict(bigTrieDicts, trieBasedDictTest);
})
.add(' - Trie-based WASM', function() {
bms.add(' - Set-based', function() {
lookupDict(setDicts, setBasedDictTest);
}).add(' - Trie-based JS (3rd-gen)', function() {
lookupDict(bigTrieDicts, trieBasedDictTest);
});
if ( hnBigTrieWASM.matchesWASM !== null ) {
bms.add(' - Trie-based WASM (3rd-gen)', function() {
lookupDict(bigTrieDicts, trieBasedDictTestWASM);
})
.on('start', function() {
}
bms.on('start', function() {
for ( let i = 0; i < lookupCount; i++ ) {
needles[i] = randomNeedle();
}
@ -239,15 +236,13 @@ function initBenchmarks() {
' and ' + hostnameLists[hostnameLists.length-1].length +
' hostnames\n'
);
})
.on('cycle', function(event) {
stdout(gWhich, String(event.target) + '\n');
})
.on('complete', ( ) => {
}).on('cycle', function(event) {
stdout(gWhich, String(event.target) + '\n');
}).on('complete', ( ) => {
setDicts = bigTrieDicts = results = [];
hnBigTrieJS.reset();
exitBenchmark();
});
});
return bms;
})());