From 22aa3d48997f1fc31e9c9cc08ec76a5436c93fe3 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Mon, 17 Apr 2017 04:01:12 +0300 Subject: benchmark: reduce string concatenations PR-URL: https://github.com/nodejs/node/pull/12455 Reviewed-By: Benjamin Gruenbaum Reviewed-By: James M Snell --- benchmark/misc/console.js | 8 ++++---- benchmark/misc/v8-bench.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'benchmark/misc') diff --git a/benchmark/misc/console.js b/benchmark/misc/console.js index 9c5aec0eee..9c7c548590 100644 --- a/benchmark/misc/console.js +++ b/benchmark/misc/console.js @@ -21,7 +21,7 @@ var bench = common.createBenchmark(main, { const nullStream = createNullStream(); function usingRestAndConcat(...args) { - nullStream.write('this is ' + args[0] + ' of ' + args[1] + '\n'); + nullStream.write(`this is ${args[0]} of ${args[1]}\n`); } function usingRestAndSpreadTS(...args) { @@ -37,15 +37,15 @@ function usingArgumentsAndApplyTS() { } function usingRestAndSpreadC(...args) { - nullStream.write(util.format(...args) + '\n'); + nullStream.write(`${util.format(...args)}\n`); } function usingRestAndApplyC(...args) { - nullStream.write(util.format.apply(null, args) + '\n'); + nullStream.write(`${util.format.apply(null, args)}\n`); } function usingArgumentsAndApplyC() { - nullStream.write(util.format.apply(null, arguments) + '\n'); + nullStream.write(`${util.format.apply(null, arguments)}\n`); } function runUsingRestAndConcat(n) { diff --git a/benchmark/misc/v8-bench.js b/benchmark/misc/v8-bench.js index 85c64b51fd..97ff0c35c4 100644 --- a/benchmark/misc/v8-bench.js +++ b/benchmark/misc/v8-bench.js @@ -9,8 +9,8 @@ var dir = path.join(__dirname, '..', '..', 'deps', 'v8', 'benchmarks'); function load(filename, inGlobal) { var source = fs.readFileSync(path.join(dir, filename), 'utf8'); - if (!inGlobal) source = '(function () {' + source + '\n})()'; - vm.runInThisContext(source, { filename: 'v8/bechmark/' + filename }); + if (!inGlobal) source = `(function () {${source}\n})()`; + vm.runInThisContext(source, { filename: `v8/bechmark/${filename}` }); } load('base.js', true); @@ -41,13 +41,13 @@ global.BenchmarkSuite.RunSuites({ }); }, NotifyError: function(name, error) { - console.error(name + ': ' + error); + console.error(`${name}: ${error}`); }, NotifyScore: function(score) { common.sendResult({ name: benchmark_name, conf: { - benchmark: 'Score (version ' + global.BenchmarkSuite.version + ')' + benchmark: `Score (version ${global.BenchmarkSuite.version})` }, rate: score, time: 0 -- cgit v1.2.3