Skip to content

Commit

Permalink
benchmark: convert var to es6 const
Browse files Browse the repository at this point in the history
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 Sep 20, 2017
1 parent d75e9b7 commit 855d7ae
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 57 deletions.
36 changes: 17 additions & 19 deletions benchmark/arrays/var-int.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
36 changes: 17 additions & 19 deletions benchmark/arrays/zero-float.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
36 changes: 17 additions & 19 deletions benchmark/arrays/zero-int.js
Original file line number Diff line number Diff line change
@@ -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.

Copy link
@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

Expand Down

0 comments on commit 855d7ae

Please sign in to comment.