summaryrefslogtreecommitdiff
path: root/benchmark/module
diff options
context:
space:
mode:
authorVse Mozhet Byt <vsemozhetbyt@gmail.com>2017-04-17 04:01:12 +0300
committerVse Mozhet Byt <vsemozhetbyt@gmail.com>2017-04-20 04:46:37 +0300
commit22aa3d48997f1fc31e9c9cc08ec76a5436c93fe3 (patch)
tree255361bcfb0611af60f6c7c101c886687d0ce047 /benchmark/module
parentbbbb1f60780d9b8ef812769e215be830c4d968b8 (diff)
downloadnode-new-22aa3d48997f1fc31e9c9cc08ec76a5436c93fe3.tar.gz
benchmark: reduce string concatenations
PR-URL: https://github.com/nodejs/node/pull/12455 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'benchmark/module')
-rw-r--r--benchmark/module/module-loader.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/benchmark/module/module-loader.js b/benchmark/module/module-loader.js
index d7e03cfee4..7c72ac1d5c 100644
--- a/benchmark/module/module-loader.js
+++ b/benchmark/module/module-loader.js
@@ -20,13 +20,13 @@ function main(conf) {
try { fs.mkdirSync(benchmarkDirectory); } catch (e) {}
for (var i = 0; i <= n; i++) {
- fs.mkdirSync(benchmarkDirectory + i);
+ fs.mkdirSync(`${benchmarkDirectory}${i}`);
fs.writeFileSync(
- benchmarkDirectory + i + '/package.json',
+ `${benchmarkDirectory}${i}/package.json`,
'{"main": "index.js"}'
);
fs.writeFileSync(
- benchmarkDirectory + i + '/index.js',
+ `${benchmarkDirectory}${i}/index.js`,
'module.exports = "";'
);
}
@@ -43,12 +43,12 @@ function measureFull(n, useCache) {
var i;
if (useCache) {
for (i = 0; i <= n; i++) {
- require(benchmarkDirectory + i + '/index.js');
+ require(`${benchmarkDirectory}${i}/index.js`);
}
}
bench.start();
for (i = 0; i <= n; i++) {
- require(benchmarkDirectory + i + '/index.js');
+ require(`${benchmarkDirectory}${i}/index.js`);
}
bench.end(n / 1e3);
}
@@ -57,12 +57,12 @@ function measureDir(n, useCache) {
var i;
if (useCache) {
for (i = 0; i <= n; i++) {
- require(benchmarkDirectory + i);
+ require(`${benchmarkDirectory}${i}`);
}
}
bench.start();
for (i = 0; i <= n; i++) {
- require(benchmarkDirectory + i);
+ require(`${benchmarkDirectory}${i}`);
}
bench.end(n / 1e3);
}