The purpose of this pane is strictly for development purpose. Please, do not open issues about it.
-
Static Network Filtering Engine: ?
+
Static Network Filtering Engine
+
+
diff --git a/src/css/benchmarks.css b/src/css/benchmarks.css
new file mode 100644
index 000000000..d644bfb6c
--- /dev/null
+++ b/src/css/benchmarks.css
@@ -0,0 +1,25 @@
+/**
+ uBlock Origin - a browser extension to block requests.
+ Copyright (C) 2018-present Raymond Hill
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see {http://www.gnu.org/licenses/}.
+
+ Home: https://github.com/gorhill/uBlock
+*/
+
+#results {
+ font-family: mono;
+ font-size: 90%;
+ white-space: pre;
+ }
diff --git a/src/js/benchmarks.js b/src/js/benchmarks.js
index a6791f85f..8f7e0409f 100644
--- a/src/js/benchmarks.js
+++ b/src/js/benchmarks.js
@@ -181,6 +181,15 @@ const contexts = [
/******************************************************************************/
+const stdout = function(s) {
+ const parent = document.getElementById('results');
+ const line = document.createElement('div');
+ line.textContent = s;
+ parent.insertBefore(line, parent.firstElementChild);
+};
+
+/******************************************************************************/
+
document.querySelector('#staticNetFilteringEngine button').addEventListener(
'click',
( ) => {
@@ -191,11 +200,9 @@ document.querySelector('#staticNetFilteringEngine button').addEventListener(
contexts,
},
response => {
- document.querySelector('#staticNetFilteringEngine .results')
- .textContent =
- `${response.duration.toFixed(2)} ms for ${contexts.length} requests, ${(response.duration / contexts.length).toFixed(3)} ms/request`;
+ stdout(`Static Network Filtering Engine: ${response.duration.toFixed(2)} ms for ${contexts.length} requests, ${(response.duration / contexts.length).toFixed(3)} ms/request`);
}
- )
+ );
}
);