Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Unify structure of sync and async benchmarks

  • Loading branch information...
commit 8f98b19d2eba2275d858e412d8378ab14dc67967 1 parent 04add5b
@nikhilm authored
Showing with 13 additions and 10 deletions.
  1. +8 −9 async.js
  2. +5 −1 sync.js
View
17 async.js
@@ -7,20 +7,19 @@ var isMp3 = function(path) { return path.match(/\.mp3$/); }
//for (var i = 1; i < 30; i++)
match.find(process.argv[2], {fileFilters: [isMp3]}, function(err, files) {
- var count = 0;
- var fEC = 0;
var t = Date.now();
+ var count = 0;
+ console.log(files.length, "files");
async.forEach(files, function(fn, cb) {
- fEC++;
- //console.log("forEach", fEC);
- taglib.tag(fn, function() {
- count++;
- //console.log(tag.title);
+ taglib.tag(fn, function(err, tag) {
+ if (!err)
+ count++;
+ console.log(tag.title);
//tag.dispose();
cb(false);
});
}, function() {
- console.log("Async", Date.now() - t);
- console.log("Tag succeeded on ", count);
+ console.log("async", Date.now() - t);
+ console.log("Tag succeeded on", count);
});
});
View
6 sync.js
@@ -4,14 +4,18 @@ var match = require('match-files');
var isMp3 = function(path) { return path.match(/\.mp3$/); }
-for (var i = 0; i < 30; i++)
+//for (var i = 0; i < 10; i++)
match.find(process.argv[2], {fileFilters: [isMp3]}, function(err, files) {
var t = Date.now();
+ var count = 0;
+ console.log(files.length, "files");
files.forEach(function(fn) {
try {
var tag = taglib.tagSync(fn);
+ count++;
console.log(tag.title);
} catch(e) {}
});
console.log("sync", Date.now() - t);
+ console.log("Tag succeeded on", count);
});

0 comments on commit 8f98b19

Please sign in to comment.
Something went wrong with that request. Please try again.