diff options
Diffstat (limited to 'deps/node/benchmark/fs/bench-realpath.js')
-rw-r--r-- | deps/node/benchmark/fs/bench-realpath.js | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/deps/node/benchmark/fs/bench-realpath.js b/deps/node/benchmark/fs/bench-realpath.js deleted file mode 100644 index 97148437..00000000 --- a/deps/node/benchmark/fs/bench-realpath.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -const common = require('../common'); -const fs = require('fs'); -const path = require('path'); -const resolved_path = path.resolve(__dirname, '../../lib/'); -const relative_path = path.relative(__dirname, '../../lib/'); - -const bench = common.createBenchmark(main, { - n: [1e4], - pathType: ['relative', 'resolved'], -}); - - -function main({ n, pathType }) { - bench.start(); - if (pathType === 'relative') - relativePath(n); - else - resolvedPath(n); -} - -function relativePath(n) { - (function r(cntr) { - if (cntr-- <= 0) - return bench.end(n); - fs.realpath(relative_path, () => { - r(cntr); - }); - }(n)); -} - -function resolvedPath(n) { - (function r(cntr) { - if (cntr-- <= 0) - return bench.end(n); - fs.realpath(resolved_path, () => { - r(cntr); - }); - }(n)); -} |