rsnext/bench/readdir/glob.js
matamatanot c922c6a3f4
Replace 'require' with 'import' in bench files and update dependancies (#25775)
## Feature

- [ ] Telemetry added. In case of a feature if it's used or not.

### Replace 'require' with 'import' in bench files
Node.js 12 allows you to use `import`.

### Update dependancies
https://github.com/jprichardson/node-fs-extra/blob/master/CHANGELOG.md#breaking-changes

> Require Node.js v12+

For #25761, Node.js 12 is required. Therefore, there is no problem updating it. For benchmarking purposes, it would be reasonable to update to the latest version.
2021-06-04 14:30:52 +00:00

24 lines
513 B
JavaScript

import { join } from 'path'
import { promisify } from 'util'
import globMod from 'glob'
const glob = promisify(globMod)
const resolveDataDir = join(__dirname, 'fixtures', '**/*')
async function test() {
const time = process.hrtime()
await glob(resolveDataDir)
const hrtime = process.hrtime(time)
const nanoseconds = hrtime[0] * 1e9 + hrtime[1]
const milliseconds = nanoseconds / 1e6
console.log(milliseconds)
}
async function run() {
for (let i = 0; i < 50; i++) {
await test()
}
}
run()