(n, cache, files, name)
| 42 | } |
| 43 | |
| 44 | function measureDir(n, cache, files, name) { |
| 45 | if (cache) { |
| 46 | for (let i = 0; i <= files; i++) { |
| 47 | require(`${benchmarkDirectory}${i}${name}`); |
| 48 | } |
| 49 | } |
| 50 | bench.start(); |
| 51 | for (let i = 0; i <= files; i++) { |
| 52 | for (let j = 0; j < n; j++) |
| 53 | require(`${benchmarkDirectory}${i}${name}`); |
| 54 | // Pretend mixed input (otherwise the results are less representative due to |
| 55 | // highly specialized code). |
| 56 | require(otherModules[i % otherModules.length]); |
| 57 | } |
| 58 | bench.end(n * files); |
| 59 | } |