mirror of
https://github.com/nodejs/node.git
synced 2024-11-24 03:07:54 +01:00
dde0cffb2e
PR-URL: https://github.com/nodejs/node/pull/52236 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
27 lines
473 B
JavaScript
27 lines
473 B
JavaScript
'use strict';
|
|
const common = require('../common.js');
|
|
const { posix } = require('path');
|
|
const assert = require('assert');
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
path: [
|
|
'',
|
|
'.',
|
|
'/tmp/bar',
|
|
'/home/node/..',
|
|
posix.join(__dirname, '/..'),
|
|
'bar/baz',
|
|
],
|
|
n: [1e5],
|
|
});
|
|
|
|
function main({ n, path }) {
|
|
bench.start();
|
|
let a;
|
|
for (let i = 0; i < n; i++) {
|
|
a = posix.toNamespacedPath(path);
|
|
}
|
|
bench.end(n);
|
|
assert.ok(a + 'a');
|
|
}
|