Relevant to this discussion: http://mrale.ph/blog/2012/12/15/microbenchmarks-fairy-tale.html
Always profile before you optimize! (Flamegraphs are pretty much the ideal tool for this.) Then optimize the bits where your program is *actually* spending time. If you're spending less than 10% of your programs' time in a particular function, then don't even bother. If your application's performance is impacted by even as much as 0.5% as a result of whether you return the cb call, or return right after it, I'll be flabbergasted. If you are accurately *testing* this with a microbenchmark (and not just doing silly little dances with the compiler), then you deserve a medal. On Wed, Dec 19, 2012 at 9:13 AM, mscdex <[email protected]> wrote: > On Dec 19, 12:08 pm, mscdex <[email protected]> wrote: >> On Dec 19, 10:11 am, Camilo Aguilar <[email protected]> wrote: >> >> > I updated the jsperf test to reflect a bit better the scenario being >> > discussed:http://jsperf.com/return-vs-no-return/4 >> > It seems like v8 optimizes better callback(); return; than return >> > callback(); >> >> On Chrome 23 doesReturn is fastest followed by doesValuelessReturn and >> then noReturn. > > I forgot to add: it's also faster on the node master branch -- they > must use similar versions of v8? > > -- > 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 [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
