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

format.js « path « benchmark - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 02fb691fe7fd07f667daf7f8532ba6b08767ff84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var common = require('../common.js');
var path = require('path');

var bench = common.createBenchmark(main, {
  type: ['win32', 'posix'],
  n: [1e7],
});

function main(conf) {
  var n = +conf.n;
  var p = path[conf.type];
  var test = conf.type === 'win32' ? {
    root: 'C:\\',
    dir: 'C:\\path\\dir',
    base: 'index.html',
    ext: '.html',
    name: 'index'
  } : {
    root : '/',
    dir : '/home/user/dir',
    base : 'index.html',
    ext : '.html',
    name : 'index'
  };

  bench.start();
  for (var i = 0; i < n; i++) {
    p.format(test);
  }
  bench.end(n);
}