Assuming that the callback doesn't return a value, does v8 behave any 
differently when invoking callbacks in one of these forms vs. the other?  I 
find the first approach to be a convenient shorthand in many cases, but am 
wondering (after observing some unexpected timings when profiling async 
methods) if it leads to v8 doing something odd with the stack.

Approach A, return the invoked callback:

function foo(a, callback) {
  var bar = ...; 
  return callback(bar);
}

foo("derp", function(b) { ...; return; });

Approach B, invoke callback, then return:

function foo(a, callback) {
   var bar = ...;
   callback(bar);
   return;
}

foo("derp", function(b) { ...; return; });

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to