From 19b7cbca553e1dba5e6c24f128cedd3198505809 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 6 Nov 2018 13:38:37 -0200 Subject: [PATCH] minor review of hntrie code --- docs/tests/hnset-benchmark.html | 19 ++++++++++++------- docs/tests/hntrie-test.html | 2 +- src/js/hntrie.js | 14 ++++++++------ 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/docs/tests/hnset-benchmark.html b/docs/tests/hnset-benchmark.html index eda502ae8..cca2425e6 100644 --- a/docs/tests/hnset-benchmark.html +++ b/docs/tests/hnset-benchmark.html @@ -17,7 +17,7 @@ - + @@ -289,11 +289,11 @@ function initBenchmarks() { const bms = new Benchmark.Suite(); const needles = []; - let setDicts = []; - let regexDicts = []; - let oldTrieDicts = [] - let newTrieDicts = [] - let results = []; + let setDicts; + let regexDicts; + let oldTrieDicts; + let newTrieDicts; + let results; const lookupDict = function(dicts, fn) { for ( let i = 0; i < needles.length; i++ ) { @@ -325,6 +325,7 @@ function initBenchmarks() { regexDicts = []; oldTrieDicts = [] newTrieDicts = [] + results = []; hnTrieManager.reset(); for ( const domainOpt of domainOpts ) { setDicts.push(setBasedDictCreate(domainOpt)); @@ -339,7 +340,11 @@ function initBenchmarks() { .on('cycle', function(event) { stdout(gWhich, String(event.target) + '\n'); }) - .on('complete', exitBenchmark); + .on('complete', ( ) => { + setDicts = regexDicts = oldTrieDicts = newTrieDicts = results = undefined; + hnTrieManager.reset(); + exitBenchmark(); + }); if ( hnTrieManager.matchesWASM !== null ) { bms.add(' - Trie-based WASM', function() { diff --git a/docs/tests/hntrie-test.html b/docs/tests/hntrie-test.html index e4c7114c6..39d99dfae 100644 --- a/docs/tests/hntrie-test.html +++ b/docs/tests/hntrie-test.html @@ -10,7 +10,7 @@
- +