1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-02 00:42:45 +01:00

do not overwrite prior results

This commit is contained in:
Raymond Hill 2018-11-03 08:08:30 -03:00
parent dbb7e80e3c
commit b94b3417d1
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
3 changed files with 40 additions and 5 deletions

View File

@ -7,6 +7,7 @@
<link rel="stylesheet" href="css/common.css">
<link rel="stylesheet" href="css/dashboard-common.css">
<link rel="stylesheet" href="css/benchmarks.css">
</head>
<body>
@ -14,7 +15,9 @@
<div class="body">
<p>The purpose of this pane is strictly for development purpose. Please, do <strong>not</strong> open issues about it.</p>
<div id="staticNetFilteringEngine">
<p>Static Network Filtering Engine: <button type="button">Measure</button> <span class="results">?</span></p>
<p>Static Network Filtering Engine <button type="button">Measure</button></p>
</div>
<div id="results">
</div>
</div>

25
src/css/benchmarks.css Normal file
View File

@ -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;
}

View File

@ -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`);
}
)
);
}
);