Skip to content

Instantly share code, notes, and snippets.

@billywhizz
Created December 12, 2010 20:27
Show Gist options
  • Save billywhizz/738302 to your computer and use it in GitHub Desktop.
Save billywhizz/738302 to your computer and use it in GitHub Desktop.
stress test for node-walk
var walk = require("./lib/walk.js");
var counter = 0;
var dirs = 0;
var files = 0;
var then = new Date().getTime();
process.argv.forEach(function(val, index, array) {
if (index > 1) {
var walker = walk(val);
walker.on("directory", function (path, file, next) {
dirs++;
counter++;
//console.log(path);
next();
});
walker.on("file", function (path, file, next) {
files++;
counter++;
//console.log(path + "/" + file.name);
next();
});
walker.on("end", function() {
var now = new Date().getTime();
console.log("time:" + ((now-then)/1000).toFixed(2) + ",total:" + counter + ",dirs:" + dirs + ",files:" + files);
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment