Permalink
Browse files

small speed improvements by reducing nextTick calls for most reporters

  • Loading branch information...
1 parent dcebdfe commit 8a31df2da23f57942a305ed9e2b92bf0db19d5f7 @caolan caolan committed Dec 2, 2010
Showing with 16 additions and 10 deletions.
  1. +16 −10 lib/types.js
View
@@ -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 = {
@@ -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 () {
@@ -173,7 +179,7 @@ exports.options = function (opt) {
optionalCallback('moduleDone');
optionalCallback('testStart');
optionalCallback('testDone');
- optionalCallback('log');
+ //optionalCallback('log');
// 'done' callback is not optional.

0 comments on commit 8a31df2

Please sign in to comment.