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:
cjihrig 2018-11-04 12:38:54 -05:00
parent a74b4a062f
commit 5407690bd7
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5
10 changed files with 17 additions and 17 deletions

View File

@ -35,7 +35,7 @@ class AutocannonBenchmarker {
let result; let result;
try { try {
result = JSON.parse(output); result = JSON.parse(output);
} catch (err) { } catch {
return undefined; return undefined;
} }
if (!result || !result.requests || !result.requests.average) { if (!result || !result.requests || !result.requests.average) {
@ -106,7 +106,7 @@ class TestDoubleBenchmarker {
let result; let result;
try { try {
result = JSON.parse(output); result = JSON.parse(output);
} catch (err) { } catch {
return undefined; return undefined;
} }
return result.throughput; return result.throughput;

View File

@ -30,7 +30,7 @@ function childProcessExecStdout({ dur, len }) {
// Sometimes there's a yes.exe process left hanging around on Windows. // Sometimes there's a yes.exe process left hanging around on Windows.
try { try {
execSync(`taskkill /f /t /pid ${child.pid}`); execSync(`taskkill /f /t /pid ${child.pid}`);
} catch (_) { } catch {
// this is a best effort kill. stderr is piped to parent for tracing. // this is a best effort kill. stderr is piped to parent for tracing.
} }
} else { } else {

View File

@ -55,7 +55,7 @@ function runTest() {
}); });
rs.on('end', function() { rs.on('end', function() {
try { fs.unlinkSync(filename); } catch (e) {} try { fs.unlinkSync(filename); } catch {}
// MB/sec // MB/sec
bench.end(bytes / (1024 * 1024)); bench.end(bytes / (1024 * 1024));
}); });
@ -74,7 +74,7 @@ function makeFile() {
buf.fill('x'); buf.fill('x');
} }
try { fs.unlinkSync(filename); } catch (e) {} try { fs.unlinkSync(filename); } catch {}
var w = 1024; var w = 1024;
const ws = fs.createWriteStream(filename); const ws = fs.createWriteStream(filename);
ws.on('close', runTest); ws.on('close', runTest);

View File

@ -24,7 +24,7 @@ const bench = common.createBenchmark(main, {
function main(conf) { function main(conf) {
const len = +conf.len; const len = +conf.len;
try { fs.unlinkSync(filename); } catch (e) {} try { fs.unlinkSync(filename); } catch {}
var data = Buffer.alloc(len, 'x'); var data = Buffer.alloc(len, 'x');
fs.writeFileSync(filename, data); fs.writeFileSync(filename, data);
data = null; data = null;
@ -39,7 +39,7 @@ function main(conf) {
const totalOps = reads + zips; const totalOps = reads + zips;
benchEnded = true; benchEnded = true;
bench.end(totalOps); bench.end(totalOps);
try { fs.unlinkSync(filename); } catch (e) {} try { fs.unlinkSync(filename); } catch {}
}, +conf.dur * 1000); }, +conf.dur * 1000);
function read() { function read() {

View File

@ -17,7 +17,7 @@ const bench = common.createBenchmark(main, {
}); });
function main({ len, dur, concurrent }) { function main({ len, dur, concurrent }) {
try { fs.unlinkSync(filename); } catch (e) {} try { fs.unlinkSync(filename); } catch {}
var data = Buffer.alloc(len, 'x'); var data = Buffer.alloc(len, 'x');
fs.writeFileSync(filename, data); fs.writeFileSync(filename, data);
data = null; data = null;
@ -28,7 +28,7 @@ function main({ len, dur, concurrent }) {
setTimeout(function() { setTimeout(function() {
benchEnded = true; benchEnded = true;
bench.end(reads); bench.end(reads);
try { fs.unlinkSync(filename); } catch (e) {} try { fs.unlinkSync(filename); } catch {}
process.exit(0); process.exit(0);
}, dur * 1000); }, dur * 1000);

View File

@ -33,7 +33,7 @@ function main({ dur, encodingType, size }) {
throw new Error(`invalid encodingType: ${encodingType}`); throw new Error(`invalid encodingType: ${encodingType}`);
} }
try { fs.unlinkSync(filename); } catch (e) {} try { fs.unlinkSync(filename); } catch {}
var started = false; var started = false;
var ended = false; var ended = false;
@ -45,7 +45,7 @@ function main({ dur, encodingType, size }) {
f.on('finish', function() { f.on('finish', function() {
ended = true; ended = true;
const written = fs.statSync(filename).size / 1024; const written = fs.statSync(filename).size / 1024;
try { fs.unlinkSync(filename); } catch (e) {} try { fs.unlinkSync(filename); } catch {}
bench.end(written / 1024); bench.end(written / 1024);
}); });

View File

@ -4,7 +4,7 @@ const common = require('../common.js');
let icu; let icu;
try { try {
icu = common.binding('icu'); icu = common.binding('icu');
} catch (err) {} } catch {}
const punycode = require('punycode'); const punycode = require('punycode');
const bench = common.createBenchmark(main, { const bench = common.createBenchmark(main, {

View File

@ -14,7 +14,7 @@ const bench = common.createBenchmark(main, {
function main({ n, fullPath, useCache }) { function main({ n, fullPath, useCache }) {
tmpdir.refresh(); tmpdir.refresh();
try { fs.mkdirSync(benchmarkDirectory); } catch (e) {} try { fs.mkdirSync(benchmarkDirectory); } catch {}
for (var i = 0; i <= n; i++) { for (var i = 0; i <= n; i++) {
fs.mkdirSync(`${benchmarkDirectory}${i}`); fs.mkdirSync(`${benchmarkDirectory}${i}`);
fs.writeFileSync( fs.writeFileSync(

View File

@ -11,14 +11,14 @@ let napi;
try { try {
v8 = require('./build/Release/binding'); v8 = require('./build/Release/binding');
} catch (err) { } catch {
console.error(`${__filename}: V8 Binding failed to load`); console.error(`${__filename}: V8 Binding failed to load`);
process.exit(0); process.exit(0);
} }
try { try {
napi = require('./build/Release/napi_binding'); napi = require('./build/Release/napi_binding');
} catch (err) { } catch {
console.error(`${__filename}: NAPI-Binding failed to load`); console.error(`${__filename}: NAPI-Binding failed to load`);
process.exit(0); process.exit(0);
} }

View File

@ -13,7 +13,7 @@ const common = require('../../common.js');
try { try {
var binding = require('./build/Release/binding'); var binding = require('./build/Release/binding');
} catch (er) { } catch {
console.error('misc/function_call.js Binding failed to load'); console.error('misc/function_call.js Binding failed to load');
process.exit(0); process.exit(0);
} }
@ -22,7 +22,7 @@ const cxx = binding.hello;
let napi_binding; let napi_binding;
try { try {
napi_binding = require('./build/Release/napi_binding'); napi_binding = require('./build/Release/napi_binding');
} catch (er) { } catch {
console.error('misc/function_call/index.js NAPI-Binding failed to load'); console.error('misc/function_call/index.js NAPI-Binding failed to load');
process.exit(0); process.exit(0);
} }