1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-04 10:09:38 +02:00

Output built-in benchmark results regardless of consoleLogLevel

This commit is contained in:
Raymond Hill 2020-07-02 12:39:40 -04:00
parent 8f3d8cde7a
commit a6355cecea
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -549,10 +549,10 @@ Matrix.prototype.fromSelfie = function(selfie) {
Matrix.prototype.benchmark = async function() {
const requests = await µBlock.loadBenchmarkDataset();
if ( Array.isArray(requests) === false || requests.length === 0 ) {
console.info('No requests found to benchmark');
log.print('No requests found to benchmark');
return;
}
console.info(`Benchmarking sessionFirewall.evaluateCellZY()...`);
log.print(`Benchmarking sessionFirewall.evaluateCellZY()...`);
const fctxt = µBlock.filteringContext.duplicate();
const t0 = self.performance.now();
for ( const request of requests ) {
@ -567,8 +567,8 @@ Matrix.prototype.benchmark = async function() {
}
const t1 = self.performance.now();
const dur = t1 - t0;
console.info(`Evaluated ${requests.length} requests in ${dur.toFixed(0)} ms`);
console.info(`\tAverage: ${(dur / requests.length).toFixed(3)} ms per request`);
log.print(`Evaluated ${requests.length} requests in ${dur.toFixed(0)} ms`);
log.print(`\tAverage: ${(dur / requests.length).toFixed(3)} ms per request`);
};
/******************************************************************************/