summaryrefslogtreecommitdiff
path: root/benchmark/path/normalize-posix.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-12-30 00:26:36 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2019-03-05 01:22:22 +0100
commit038a1a489d6d0a4d5c075611943b3c7c08f0e22a (patch)
tree6fce510b11ad12351d9c23dd241e5bbdfb59b122 /benchmark/path/normalize-posix.js
parent955be8623d58566849cf6a59ff82e78cf14f239a (diff)
downloadandroid-node-v8-038a1a489d6d0a4d5c075611943b3c7c08f0e22a.tar.gz
android-node-v8-038a1a489d6d0a4d5c075611943b3c7c08f0e22a.tar.bz2
android-node-v8-038a1a489d6d0a4d5c075611943b3c7c08f0e22a.zip
benchmark: refactor path benchmarks
So far the benchmarks created a highly specialized function which would inline exactly to the input. This changes it to provide a more realistic view to actual input by changing the input on each iteration. That prevents the function to be to specific. It also reduces the number of iterations the benchmarks are run to reduce the overall runtime. A microbenchmark should already show a significant difference with lower iterations, otherwise the significance for real world applications is only limited. PR-URL: https://github.com/nodejs/node/pull/26359 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'benchmark/path/normalize-posix.js')
-rw-r--r--benchmark/path/normalize-posix.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/benchmark/path/normalize-posix.js b/benchmark/path/normalize-posix.js
index 7b5c2b1cf9..4383cff4a5 100644
--- a/benchmark/path/normalize-posix.js
+++ b/benchmark/path/normalize-posix.js
@@ -11,13 +11,13 @@ const bench = common.createBenchmark(main, {
'/foo/bar',
'/foo/bar//baz/asdf/quux/..',
],
- n: [1e6]
+ n: [1e5]
});
function main({ n, path }) {
bench.start();
for (var i = 0; i < n; i++) {
- posix.normalize(path);
+ posix.normalize(i % 3 === 0 ? `${path}${i}` : path);
}
bench.end(n);
}