summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorAnatoli Papirovski <apapirovski@mac.com>2017-11-25 11:58:53 -0500
committerAnatoli Papirovski <apapirovski@mac.com>2017-11-28 08:48:30 -0500
commitcbaf59c5b9a6063ee384b848aeb0aceb89082179 (patch)
treea2bff4b89d3f91f9c6a8f91d2b4e901f831ee3cb /benchmark
parent1f5ee33dcb74202a0f29ed1ee2e941b36138f9b0 (diff)
downloadandroid-node-v8-cbaf59c5b9a6063ee384b848aeb0aceb89082179.tar.gz
android-node-v8-cbaf59c5b9a6063ee384b848aeb0aceb89082179.tar.bz2
android-node-v8-cbaf59c5b9a6063ee384b848aeb0aceb89082179.zip
process: slightly simplify next tick execution
Get rid of separate function to call callback from _tickCallback as it no longer yields worthwhile performance improvement. Move some code from nextTick & internalNextTick into TickObject constructor to minimize duplication. PR-URL: https://github.com/nodejs/node/pull/16888 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/process/next-tick-breadth-args.js2
-rw-r--r--benchmark/process/next-tick-breadth.js2
-rw-r--r--benchmark/process/next-tick-exec-args.js25
-rw-r--r--benchmark/process/next-tick-exec.js18
4 files changed, 45 insertions, 2 deletions
diff --git a/benchmark/process/next-tick-breadth-args.js b/benchmark/process/next-tick-breadth-args.js
index cc038dd348..ca608f15da 100644
--- a/benchmark/process/next-tick-breadth-args.js
+++ b/benchmark/process/next-tick-breadth-args.js
@@ -2,7 +2,7 @@
const common = require('../common.js');
const bench = common.createBenchmark(main, {
- millions: [2]
+ millions: [4]
});
function main(conf) {
diff --git a/benchmark/process/next-tick-breadth.js b/benchmark/process/next-tick-breadth.js
index 8f8d0adc61..51951ce0af 100644
--- a/benchmark/process/next-tick-breadth.js
+++ b/benchmark/process/next-tick-breadth.js
@@ -2,7 +2,7 @@
const common = require('../common.js');
const bench = common.createBenchmark(main, {
- millions: [2]
+ millions: [4]
});
function main(conf) {
diff --git a/benchmark/process/next-tick-exec-args.js b/benchmark/process/next-tick-exec-args.js
new file mode 100644
index 0000000000..5ff017bb29
--- /dev/null
+++ b/benchmark/process/next-tick-exec-args.js
@@ -0,0 +1,25 @@
+'use strict';
+const common = require('../common.js');
+const bench = common.createBenchmark(main, {
+ millions: [5]
+});
+
+function main(conf) {
+ var n = +conf.millions * 1e6;
+
+ bench.start();
+ for (var i = 0; i < n; i++) {
+ if (i % 4 === 0)
+ process.nextTick(onNextTick, i, true, 10, 'test');
+ else if (i % 3 === 0)
+ process.nextTick(onNextTick, i, true, 10);
+ else if (i % 2 === 0)
+ process.nextTick(onNextTick, i, 20);
+ else
+ process.nextTick(onNextTick, i);
+ }
+ function onNextTick(i) {
+ if (i + 1 === n)
+ bench.end(+conf.millions);
+ }
+}
diff --git a/benchmark/process/next-tick-exec.js b/benchmark/process/next-tick-exec.js
new file mode 100644
index 0000000000..12c9d4624a
--- /dev/null
+++ b/benchmark/process/next-tick-exec.js
@@ -0,0 +1,18 @@
+'use strict';
+const common = require('../common.js');
+const bench = common.createBenchmark(main, {
+ millions: [5]
+});
+
+function main(conf) {
+ var n = +conf.millions * 1e6;
+
+ bench.start();
+ for (var i = 0; i < n; i++) {
+ process.nextTick(onNextTick, i);
+ }
+ function onNextTick(i) {
+ if (i + 1 === n)
+ bench.end(+conf.millions);
+ }
+}