Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/path/relative.js')
-rw-r--r--benchmark/path/relative.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/benchmark/path/relative.js b/benchmark/path/relative.js
new file mode 100644
index 00000000000..3e12f8b532d
--- /dev/null
+++ b/benchmark/path/relative.js
@@ -0,0 +1,26 @@
+var common = require('../common.js');
+var path = require('path');
+
+var bench = common.createBenchmark(main, {
+ type: ['win32', 'posix'],
+ n: [1e5],
+});
+
+function main(conf) {
+ var n = +conf.n;
+ var runTest = conf.type === 'win32' ? runWin32Test : runPosixTest;
+
+ bench.start();
+ for (var i = 0; i < n; i++) {
+ runTest();
+ }
+ bench.end(n);
+}
+
+function runWin32Test() {
+ path.win32.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb');
+}
+
+function runPosixTest() {
+ path.posix.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb');
+}