From c49dcb319b22ec5084384fe279e91a88108b10e9 Mon Sep 17 00:00:00 2001 From: Sebastian Murphy Date: Sun, 7 May 2017 14:20:23 -0400 Subject: [PATCH] benchmark: convert var to es6 const MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: https://github.com/nodejs/node/pull/12886 Reviewed-By: Refael Ackermann Reviewed-By: Luigi Pinca Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Tobias Nießen --- benchmark/arrays/var-int.js | 36 ++++++++++++++++------------------ benchmark/arrays/zero-float.js | 36 ++++++++++++++++------------------ benchmark/arrays/zero-int.js | 36 ++++++++++++++++------------------ 3 files changed, 51 insertions(+), 57 deletions(-) diff --git a/benchmark/arrays/var-int.js b/benchmark/arrays/var-int.js index 9ebad61166..795d4eb838 100644 --- a/benchmark/arrays/var-int.js +++ b/benchmark/arrays/var-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); diff --git a/benchmark/arrays/zero-float.js b/benchmark/arrays/zero-float.js index a74cd8ec5b..d61b0598a4 100644 --- a/benchmark/arrays/zero-float.js +++ b/benchmark/arrays/zero-float.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); diff --git a/benchmark/arrays/zero-int.js b/benchmark/arrays/zero-int.js index 7f61aa1a82..90d491e807 100644 --- a/benchmark/arrays/zero-int.js +++ b/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);