Skip to content

Instantly share code, notes, and snippets.

@UltCombo
Created December 29, 2014 22:36
Show Gist options
  • Save UltCombo/27adde9fc0a6d511e909 to your computer and use it in GitHub Desktop.
Save UltCombo/27adde9fc0a6d511e909 to your computer and use it in GitHub Desktop.
glob-stream vs globby negative globs benchmark
'use strict';
var async = require('async');
var gs = require('glob-stream');
var globby = require('globby');
var globs = ['**/**.js', '!node_modules/**'];
function gsBenchmark(cb) {
console.time('gs');
gs.create(globs)
.on('data', console.log.bind(console))
.on('end', function() {
console.timeEnd('gs');
cb();
});
}
function globbyBenchmark(cb) {
console.time('globby');
globby(globs, function (err, paths) {
console.log(paths);
console.timeEnd('globby');
cb();
});
}
async.series([
gsBenchmark,
globbyBenchmark,
]);
/*
C:\tests\glob-perf>node .
{ cwd: 'C:\\tests\\glob-perf',
base: 'C:\\tests\\glob-perf\\',
path: 'C:\\tests\\glob-perf\\index.js' }
gs: 1515ms
[ 'index.js' ]
globby: 3392ms
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment