From 1a4c35c9cb3185140db844e989b9f3b86ded1691 Mon Sep 17 00:00:00 2001 From: Evan Lucas Date: Fri, 23 Dec 2016 15:56:52 -0600 Subject: [PATCH] process: improve performance of nextTick This replaces TickObject with an object literal. This offers performance improvements of up to ~20%. --- src/node.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/node.js b/src/node.js index 7772942de79ca1..44a3ec263e8113 100644 --- a/src/node.js +++ b/src/node.js @@ -485,12 +485,6 @@ } } - function TickObject(c, args) { - this.callback = c; - this.domain = process.domain || null; - this.args = args; - } - function nextTick(callback) { // on the way out, don't bother. it won't get fired anyway. if (process._exiting) @@ -503,7 +497,11 @@ args.push(arguments[i]); } - nextTickQueue.push(new TickObject(callback, args)); + nextTickQueue.push({ + callback, + domain: process.domain || null, + args + }); tickInfo[kLength]++; }