benchmark: remove unused catch bindings
PR-URL: https://github.com/nodejs/node/pull/24079 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Wyatt Preul <wpreul@gmail.com>
This commit is contained in:
parent
a74b4a062f
commit
5407690bd7
@ -35,7 +35,7 @@ class AutocannonBenchmarker {
|
||||
let result;
|
||||
try {
|
||||
result = JSON.parse(output);
|
||||
} catch (err) {
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
if (!result || !result.requests || !result.requests.average) {
|
||||
@ -106,7 +106,7 @@ class TestDoubleBenchmarker {
|
||||
let result;
|
||||
try {
|
||||
result = JSON.parse(output);
|
||||
} catch (err) {
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
return result.throughput;
|
||||
|
@ -30,7 +30,7 @@ function childProcessExecStdout({ dur, len }) {
|
||||
// Sometimes there's a yes.exe process left hanging around on Windows.
|
||||
try {
|
||||
execSync(`taskkill /f /t /pid ${child.pid}`);
|
||||
} catch (_) {
|
||||
} catch {
|
||||
// this is a best effort kill. stderr is piped to parent for tracing.
|
||||
}
|
||||
} else {
|
||||
|
@ -55,7 +55,7 @@ function runTest() {
|
||||
});
|
||||
|
||||
rs.on('end', function() {
|
||||
try { fs.unlinkSync(filename); } catch (e) {}
|
||||
try { fs.unlinkSync(filename); } catch {}
|
||||
// MB/sec
|
||||
bench.end(bytes / (1024 * 1024));
|
||||
});
|
||||
@ -74,7 +74,7 @@ function makeFile() {
|
||||
buf.fill('x');
|
||||
}
|
||||
|
||||
try { fs.unlinkSync(filename); } catch (e) {}
|
||||
try { fs.unlinkSync(filename); } catch {}
|
||||
var w = 1024;
|
||||
const ws = fs.createWriteStream(filename);
|
||||
ws.on('close', runTest);
|
||||
|
@ -24,7 +24,7 @@ const bench = common.createBenchmark(main, {
|
||||
|
||||
function main(conf) {
|
||||
const len = +conf.len;
|
||||
try { fs.unlinkSync(filename); } catch (e) {}
|
||||
try { fs.unlinkSync(filename); } catch {}
|
||||
var data = Buffer.alloc(len, 'x');
|
||||
fs.writeFileSync(filename, data);
|
||||
data = null;
|
||||
@ -39,7 +39,7 @@ function main(conf) {
|
||||
const totalOps = reads + zips;
|
||||
benchEnded = true;
|
||||
bench.end(totalOps);
|
||||
try { fs.unlinkSync(filename); } catch (e) {}
|
||||
try { fs.unlinkSync(filename); } catch {}
|
||||
}, +conf.dur * 1000);
|
||||
|
||||
function read() {
|
||||
|
@ -17,7 +17,7 @@ const bench = common.createBenchmark(main, {
|
||||
});
|
||||
|
||||
function main({ len, dur, concurrent }) {
|
||||
try { fs.unlinkSync(filename); } catch (e) {}
|
||||
try { fs.unlinkSync(filename); } catch {}
|
||||
var data = Buffer.alloc(len, 'x');
|
||||
fs.writeFileSync(filename, data);
|
||||
data = null;
|
||||
@ -28,7 +28,7 @@ function main({ len, dur, concurrent }) {
|
||||
setTimeout(function() {
|
||||
benchEnded = true;
|
||||
bench.end(reads);
|
||||
try { fs.unlinkSync(filename); } catch (e) {}
|
||||
try { fs.unlinkSync(filename); } catch {}
|
||||
process.exit(0);
|
||||
}, dur * 1000);
|
||||
|
||||
|
@ -33,7 +33,7 @@ function main({ dur, encodingType, size }) {
|
||||
throw new Error(`invalid encodingType: ${encodingType}`);
|
||||
}
|
||||
|
||||
try { fs.unlinkSync(filename); } catch (e) {}
|
||||
try { fs.unlinkSync(filename); } catch {}
|
||||
|
||||
var started = false;
|
||||
var ended = false;
|
||||
@ -45,7 +45,7 @@ function main({ dur, encodingType, size }) {
|
||||
f.on('finish', function() {
|
||||
ended = true;
|
||||
const written = fs.statSync(filename).size / 1024;
|
||||
try { fs.unlinkSync(filename); } catch (e) {}
|
||||
try { fs.unlinkSync(filename); } catch {}
|
||||
bench.end(written / 1024);
|
||||
});
|
||||
|
||||
|
@ -4,7 +4,7 @@ const common = require('../common.js');
|
||||
let icu;
|
||||
try {
|
||||
icu = common.binding('icu');
|
||||
} catch (err) {}
|
||||
} catch {}
|
||||
const punycode = require('punycode');
|
||||
|
||||
const bench = common.createBenchmark(main, {
|
||||
|
@ -14,7 +14,7 @@ const bench = common.createBenchmark(main, {
|
||||
|
||||
function main({ n, fullPath, useCache }) {
|
||||
tmpdir.refresh();
|
||||
try { fs.mkdirSync(benchmarkDirectory); } catch (e) {}
|
||||
try { fs.mkdirSync(benchmarkDirectory); } catch {}
|
||||
for (var i = 0; i <= n; i++) {
|
||||
fs.mkdirSync(`${benchmarkDirectory}${i}`);
|
||||
fs.writeFileSync(
|
||||
|
@ -11,14 +11,14 @@ let napi;
|
||||
|
||||
try {
|
||||
v8 = require('./build/Release/binding');
|
||||
} catch (err) {
|
||||
} catch {
|
||||
console.error(`${__filename}: V8 Binding failed to load`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
try {
|
||||
napi = require('./build/Release/napi_binding');
|
||||
} catch (err) {
|
||||
} catch {
|
||||
console.error(`${__filename}: NAPI-Binding failed to load`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ const common = require('../../common.js');
|
||||
|
||||
try {
|
||||
var binding = require('./build/Release/binding');
|
||||
} catch (er) {
|
||||
} catch {
|
||||
console.error('misc/function_call.js Binding failed to load');
|
||||
process.exit(0);
|
||||
}
|
||||
@ -22,7 +22,7 @@ const cxx = binding.hello;
|
||||
let napi_binding;
|
||||
try {
|
||||
napi_binding = require('./build/Release/napi_binding');
|
||||
} catch (er) {
|
||||
} catch {
|
||||
console.error('misc/function_call/index.js NAPI-Binding failed to load');
|
||||
process.exit(0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user