Conversation
d09cb2f to
1802b8d
Compare
src/node.js
Outdated
There was a problem hiding this comment.
What's the point of a try { ... } finally {} with an empty finalizer?
There was a problem hiding this comment.
I just copied from the original function (_tickCallback/_tickDomainCallback). I can safely delete it I guess? Unless it was originally supposed to catch exceptions?
There was a problem hiding this comment.
in _tickCallback there's code in the finalizer – if control passes to the finalizer, tickDone is called before the exception propagates as usual. It should be replicable by moving the try {} finally { if (threw) tickDone() } back up into _tickCallback, wrapping these lines in the TryClause.
|
@chrisdickinson I've adjusted the benchmarks, is that what you had in mind? |
There was a problem hiding this comment.
might add a case for process.nextTick(cb) by itself.
There was a problem hiding this comment.
So I should merge the pre-existing non-args benchmark with this one?
|
@mscdex re: benchmarks, yep! I had one other pony request relating to them (related to including |
|
A bit verbose, but if it offers the performance improvements you said then I'm okay with the change. |
There was a problem hiding this comment.
a nit: would you mind adding a comment briefly explaining why this call is separated into a switch statement, for future readers?
This commit uses separate functions to isolate deopts caused by try-catches and avoids fn.apply() for callbacks with small numbers of arguments. These changes improve performance by ~1-40% in the various nextTick benchmarks.
|
Cool – after the changes, are the numbers still ~2-42% better than the previous implementation? If so, LGTM! |
|
@chrisdickinson Yep, performance is still in the same range. |
This commit uses separate functions to isolate deopts caused by try-catches and avoids fn.apply() for callbacks with small numbers of arguments. These changes improve performance by ~1-40% in the various nextTick benchmarks. PR-URL: #1571 Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
|
Landed in c7782c0. |
This commit uses separate functions to isolate deopts caused by try-catches and avoids fn.apply() for callbacks with small numbers of arguments. These changes improve performance by ~1-40% in the various nextTick benchmarks. PR-URL: nodejs#1571 Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
This commit uses separate functions to isolate deopts caused by
try-finallys and avoids
fn.apply()for callbacks with small numbersof arguments.
These changes improve performance by ~2-42% in the various
nextTick benchmarks.