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