Skip to content

Commit

Permalink
small speed improvements by reducing nextTick calls for most reporters
Browse files Browse the repository at this point in the history
  • Loading branch information
Caolan McMahon committed Dec 2, 2010
1 parent dcebdfe commit 8a31df2
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions lib/types.js
Expand Up @@ -106,9 +106,11 @@ exports.test = function (name, start, options, callback) {

var wrapAssert = assertWrapper(function (a) {
a_list.push(a);
async.nextTick(function () {
options.log(a);
});
if (options.log) {
async.nextTick(function () {
options.log(a);
});
}
});

var test = {
Expand All @@ -120,16 +122,20 @@ exports.test = function (name, start, options, callback) {
);
var a1 = exports.assertion({method: 'expect', error: e});
a_list.push(a1);
async.nextTick(function () {
options.log(a1);
});
if (options.log) {
async.nextTick(function () {
options.log(a1);
});
}
}
if (err) {
var a2 = exports.assertion({error: err});
a_list.push(a2);
async.nextTick(function () {
options.log(a2);
});
if (options.log) {
async.nextTick(function () {
options.log(a2);
});
}
}
var end = new Date().getTime();
async.nextTick(function () {
Expand Down Expand Up @@ -173,7 +179,7 @@ exports.options = function (opt) {
optionalCallback('moduleDone');
optionalCallback('testStart');
optionalCallback('testDone');
optionalCallback('log');
//optionalCallback('log');

// 'done' callback is not optional.

Expand Down

0 comments on commit 8a31df2

Please sign in to comment.