On Fri, Apr 13, 2012 at 08:48:21PM +0200, Oliver Leics wrote: > On Fri, Apr 13, 2012 at 7:26 PM, Jann Horn <[email protected]> wrote: > > On Fri, Apr 13, 2012 at 10:07:38AM +0200, Oliver Leics wrote: > >> What about option C, not using 'return': > >> > >> function (opts, cb) { > >> thing(opts, function (err, data) { > >> if (err) { > >> cb(err); > >> } else { > >> var result = transform(data); > >> > >> cb(null, result); > >> } > >> }); > >> }); > >> > >> Aside from readability and number of characters to type, is this > >> option C better or worse than using return? > > > > Well, when you leave readability and so on away, what's left here? I think > > that his option is the ugliest one because it requires you to indent the > > rest > > of the code (unlike guard syntax). > > First: Would you be so kind and stop talking in third person about me > when I'm around? Thank you.
I'm sorry. I think I wanted to write "this", not "his". That probably looked a bit offensive. :( > Second: I know that this requires to intend the rest of the code. > > But what I really want to know is about technical reasons, not style. > I want to know if it makes any difference to the JIT, v8, or whatever > stacks around. Is not using return an improvement, an deterioration or > does it make no difference for performance/code optimization. > > So, under the scope of the question of the OP: What about not using return? If you're concerned that much about speed, you might want to hack in C or so. :D And if you believe in microbenchmarks: http://jsperf.com/return-vs-no-return
pgpLz1if8EL8e.pgp
Description: PGP signature
