| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Filter matching performance measurements</title> | 4 <title>Filter matching performance measurements</title> |
| 5 <script type="application/x-javascript;version=1.7" src="common.js"></script> | 5 <script type="application/x-javascript;version=1.7" src="common.js"></script> |
| 6 <script type="application/x-javascript;version=1.7" src="../common.js"></scrip
t> | 6 <script type="application/x-javascript;version=1.7" src="../common.js"></scrip
t> |
| 7 </head> | 7 </head> |
| 8 <body> | 8 <body> |
| 9 <p> | 9 <p> |
| 10 Filters to be used:<br> | 10 Filters to be used:<br> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 .filter(function(filter)
filter instanceof RegExpFilter); | 52 .filter(function(filter)
filter instanceof RegExpFilter); |
| 53 document.getElementById("filters").value = filters.map(function(filter) fi
lter.text) | 53 document.getElementById("filters").value = filters.map(function(filter) fi
lter.text) |
| 54 .join("\n"); | 54 .join("\n"); |
| 55 addresses = document.getElementById("addresses").value.replace(/^[\r\n]+/,
"") | 55 addresses = document.getElementById("addresses").value.replace(/^[\r\n]+/,
"") |
| 56 .replace(/[\r\n]+$/,
"") | 56 .replace(/[\r\n]+$/,
"") |
| 57 .split(/[\r\n]+/); | 57 .split(/[\r\n]+/); |
| 58 document.getElementById("result").textContent = ""; | 58 document.getElementById("result").textContent = ""; |
| 59 document.getElementById("progress").style.display = ""; | 59 document.getElementById("progress").style.display = ""; |
| 60 | 60 |
| 61 defaultMatcher.clear(); | 61 defaultMatcher.clear(); |
| 62 for each (let filter in filters) | 62 for (let filter of filters) |
| 63 defaultMatcher.add(filter); | 63 defaultMatcher.add(filter); |
| 64 | 64 |
| 65 runTests(runTest, cleanup, finalize); | 65 runTests(runTest, cleanup, finalize); |
| 66 } | 66 } |
| 67 | 67 |
| 68 function runTest() | 68 function runTest() |
| 69 { | 69 { |
| 70 for each (let address in addresses) | 70 for (let address of addresses) |
| 71 defaultMatcher.matchesAny(address, "IMAGE", null, false); | 71 defaultMatcher.matchesAny(address, "IMAGE", null, false); |
| 72 } | 72 } |
| 73 | 73 |
| 74 function cleanup() | 74 function cleanup() |
| 75 { | 75 { |
| 76 // Add and remove a dummy filter to clear matcher's cache | 76 // Add and remove a dummy filter to clear matcher's cache |
| 77 let dummy = Filter.fromText("foobar"); | 77 let dummy = Filter.fromText("foobar"); |
| 78 defaultMatcher.add(dummy); | 78 defaultMatcher.add(dummy); |
| 79 defaultMatcher.remove(dummy); | 79 defaultMatcher.remove(dummy); |
| 80 } | 80 } |
| 81 | 81 |
| 82 function finalize() | 82 function finalize() |
| 83 { | 83 { |
| 84 document.getElementById("progress").style.display = "none"; | 84 document.getElementById("progress").style.display = "none"; |
| 85 document.getElementById("filters").disabled = false; | 85 document.getElementById("filters").disabled = false; |
| 86 document.getElementById("addresses").disabled = false; | 86 document.getElementById("addresses").disabled = false; |
| 87 document.getElementById("startButton").disabled = false; | 87 document.getElementById("startButton").disabled = false; |
| 88 filters = null; | 88 filters = null; |
| 89 addresses = null; | 89 addresses = null; |
| 90 } | 90 } |
| 91 </script> | 91 </script> |
| 92 </body> | 92 </body> |
| 93 </html> | 93 </html> |
| OLD | NEW |