• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common.js');
3const { posix } = require('path');
4
5const bench = common.createBenchmark(main, {
6  path: [
7    '',
8    '/',
9    '/foo',
10    'foo/.bar.baz',
11    'index.html',
12    'index',
13    'foo/bar/..baz.quux',
14    'foo/bar/...baz.quux',
15    '/foo/bar/baz/asdf/quux',
16    '/foo/bar/baz/asdf/quux.foobarbazasdfquux',
17  ],
18  n: [1e5],
19});
20
21function main({ n, path }) {
22  bench.start();
23  for (let i = 0; i < n; i++) {
24    posix.extname(i % 3 === 0 ? `${path}${i}` : path);
25  }
26  bench.end(n);
27}
28