benchmark: fix comment typos and code format
I noticed some typos and the lack of {} following an if. PR-URL: https://github.com/nodejs/node/pull/7961 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
This commit is contained in:
parent
b9832eb3fe
commit
9e7fd8e810
@ -30,7 +30,7 @@ function Benchmark(fn, options) {
|
|||||||
Benchmark.prototype._parseArgs = function(argv, options) {
|
Benchmark.prototype._parseArgs = function(argv, options) {
|
||||||
const cliOptions = Object.assign({}, options);
|
const cliOptions = Object.assign({}, options);
|
||||||
|
|
||||||
// Parse configuarion arguments
|
// Parse configuration arguments
|
||||||
for (const arg of argv) {
|
for (const arg of argv) {
|
||||||
const match = arg.match(/^(.+?)=([\s\S]*)$/);
|
const match = arg.match(/^(.+?)=([\s\S]*)$/);
|
||||||
if (!match || !match[1]) {
|
if (!match || !match[1]) {
|
||||||
@ -52,7 +52,7 @@ Benchmark.prototype._queue = function(options) {
|
|||||||
const queue = [];
|
const queue = [];
|
||||||
const keys = Object.keys(options);
|
const keys = Object.keys(options);
|
||||||
|
|
||||||
// Perform a depth-first walk though all options to genereate a
|
// Perform a depth-first walk though all options to generate a
|
||||||
// configuration list that contains all combinations.
|
// configuration list that contains all combinations.
|
||||||
function recursive(keyIndex, prevConfig) {
|
function recursive(keyIndex, prevConfig) {
|
||||||
const key = keys[keyIndex];
|
const key = keys[keyIndex];
|
||||||
@ -171,9 +171,9 @@ Benchmark.prototype._run = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Benchmark.prototype.start = function() {
|
Benchmark.prototype.start = function() {
|
||||||
if (this._started)
|
if (this._started) {
|
||||||
throw new Error('Called start more than once in a single benchmark');
|
throw new Error('Called start more than once in a single benchmark');
|
||||||
|
}
|
||||||
this._started = true;
|
this._started = true;
|
||||||
this._time = process.hrtime();
|
this._time = process.hrtime();
|
||||||
};
|
};
|
||||||
@ -195,7 +195,7 @@ Benchmark.prototype.end = function(operations) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function formatResult(data) {
|
function formatResult(data) {
|
||||||
// Construct confiuration string, " A=a, B=b, ..."
|
// Construct configuration string, " A=a, B=b, ..."
|
||||||
let conf = '';
|
let conf = '';
|
||||||
for (const key of Object.keys(data.conf)) {
|
for (const key of Object.keys(data.conf)) {
|
||||||
conf += ' ' + key + '=' + JSON.stringify(data.conf[key]);
|
conf += ' ' + key + '=' + JSON.stringify(data.conf[key]);
|
||||||
|
@ -65,7 +65,7 @@ console.log('"binary", "filename", "configuration", "rate", "time"');
|
|||||||
}
|
}
|
||||||
conf = conf.slice(1);
|
conf = conf.slice(1);
|
||||||
|
|
||||||
// Escape qoutes (") for correct csv formatting
|
// Escape quotes (") for correct csv formatting
|
||||||
conf = conf.replace(/"/g, '""');
|
conf = conf.replace(/"/g, '""');
|
||||||
|
|
||||||
console.log(`"${job.binary}", "${job.filename}", "${conf}", ` +
|
console.log(`"${job.binary}", "${job.filename}", "${conf}", ` +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user