Commit 6f75b667 authored by Andras's avatar Andras Committed by Jeremiah Senkpiel
Browse files

timers: optimize `setImmediate()`

Save the setImmediate() callback arguments into an array instead of a
closure, and invoke the callback on the arguments from an optimizable
function.

  60% faster setImmediate with 0 args (15% if self-recursive)
  4x faster setImmediate with 1-3 args, 2x with > 3
  seems to be faster with less memory pressure when memory is tight

Changes:
- use L.create() to build faster lists
- use runCallback() from within tryOnImmediate()
- save the arguments and do not build closures for the callbacks

PR-URL: https://github.com/nodejs/node/pull/6436


Reviewed-By: default avatarBenjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: default avatarJeremiah Senkpiel <fishrock123@rocketmail.com>
parent 6b0f86a8
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment