Permalink
Browse files

benchmark: convert var to es6 const

Converted var variable to es6 const to maintain
consistency with other benchmark files. Also clean up
the types array to make the files more succinct.

PR-URL: #12886
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
  • Loading branch information...
sebasmurphy authored and MylesBorins committed May 7, 2017
1 parent d75e9b7 commit 855d7ae326004a22d34abc49bac9de5877b08c34
Showing with 51 additions and 57 deletions.
  1. +17 −19 benchmark/arrays/var-int.js
  2. +17 −19 benchmark/arrays/zero-float.js
  3. +17 −19 benchmark/arrays/zero-int.js
@@ -1,28 +1,26 @@
'use strict';
var common = require('../common.js');
const common = require('../common.js');
var types = [
'Array',
'Buffer',
'Int8Array',
'Uint8Array',
'Int16Array',
'Uint16Array',
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array'
];
var bench = common.createBenchmark(main, {
type: types,
const bench = common.createBenchmark(main, {
type: [
'Array',
'Buffer',
'Int8Array',
'Uint8Array',
'Int16Array',
'Uint16Array',
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array'
],
n: [25]
});
function main(conf) {
var type = conf.type;
var clazz = global[type];
var n = +conf.n;
const type = conf.type;
const clazz = global[type];
const n = +conf.n;
bench.start();
var arr = new clazz(n * 1e6);
@@ -1,28 +1,26 @@
'use strict';
var common = require('../common.js');
const common = require('../common.js');
var types = [
'Array',
'Buffer',
'Int8Array',
'Uint8Array',
'Int16Array',
'Uint16Array',
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array'
];
var bench = common.createBenchmark(main, {
type: types,
const bench = common.createBenchmark(main, {
type: [
'Array',
'Buffer',
'Int8Array',
'Uint8Array',
'Int16Array',
'Uint16Array',
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array'
],
n: [25]
});
function main(conf) {
var type = conf.type;
var clazz = global[type];
var n = +conf.n;
const type = conf.type;
const clazz = global[type];
const n = +conf.n;
bench.start();
var arr = new clazz(n * 1e6);
@@ -1,28 +1,26 @@
'use strict';
var common = require('../common.js');
const common = require('../common.js');
var types = [
'Array',
'Buffer',
'Int8Array',
'Uint8Array',
'Int16Array',
'Uint16Array',
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array'
];
var bench = common.createBenchmark(main, {
type: types,
const bench = common.createBenchmark(main, {
type: [
'Array',
'Buffer',
'Int8Array',
'Uint8Array',
'Int16Array',
'Uint16Array',
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array'
],
n: [25]
});
function main(conf) {
var type = conf.type;
var clazz = global[type];
var n = +conf.n;
const type = conf.type;
const clazz = global[type];
const n = +conf.n;
bench.start();
var arr = new clazz(n * 1e6);

This comment has been minimized.

Show comment
Hide comment
@kunle

kunle Oct 5, 2017

arr could have been changed to a const also. Looking at the code if you are just changing the content of the array then its okay. const k = [1]; k[0]=0; //no error

@kunle

kunle Oct 5, 2017

arr could have been changed to a const also. Looking at the code if you are just changing the content of the array then its okay. const k = [1]; k[0]=0; //no error

0 comments on commit 855d7ae

Please sign in to comment.