forked from adonisjs/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoload.js
More file actions
32 lines (27 loc) · 736 Bytes
/
autoload.js
File metadata and controls
32 lines (27 loc) · 736 Bytes
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
32
'use strict'
const Benchmark = require('benchmark')
const suite = new Benchmark.Suite
const requireDirectory = require('require-directory')
const autoLoad = require('auto-loader')
const path = require('path')
const dir = path.join(__dirname, '../src')
const loadViaReqDir = function () {
return requireDirectory(module,dir)
}
const loadViaAutoLoad = function () {
return autoLoad(dir)
}
suite.add('via require-directory', function () {
loadViaReqDir()
})
.add('via auto-load', function () {
loadViaAutoLoad()
})
.on('cycle', function(event) {
console.log(String(event.target));
})
.on('complete', function() {
console.log('Fastest is ' + this.filter('fastest').pluck('name'));
})
// run async
.run({ 'async': true });