2 * Benchmark runner dependencies
5 var colors = require('colors')
6 , path = require('path');
9 * Find all the benchmarks
12 var benchmarks_files = process.env.BENCHMARKS.split(' ')
13 , all = [].concat(benchmarks_files)
17 // find the benchmarks and load them all in our obj
18 benchmarks_files.forEach(function (file) {
19 benchmarks[file] = require(path.join(__dirname, '..', file));
22 // setup the complete listeners
23 benchmarks_files.forEach(function (file) {
24 var benchmark = benchmarks[file]
25 , next_file = all.shift()
26 , next = benchmarks[next_file];
29 * Generate a oncomplete function for the tests, either we are done or we
30 * have more benchmarks to process.
33 function complete () {
36 '\n\nBenchmark completed in'.grey
37 , (Date.now() - start).toString().green + ' ms'.grey
40 console.log('\nStarting benchmark '.grey + next_file.yellow);
45 // attach the listener
46 benchmark.on('complete', complete);
53 var start = Date.now();
54 console.log('Starting benchmark '.grey + first.yellow);
55 benchmarks[first].run();