diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-08-13 12:29:07 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-08-13 12:29:22 +0200 |
commit | da736d8259331a8ef13bf4bbb10bbb8a5c0e5299 (patch) | |
tree | 4d849133b1c9a9c7067e96ff7dd8faa1d927e0bb /deps/node/benchmark/timers | |
parent | da228cf9d71b747f1824e85127039e5afc7effd8 (diff) | |
download | akono-da736d8259331a8ef13bf4bbb10bbb8a5c0e5299.tar.gz akono-da736d8259331a8ef13bf4bbb10bbb8a5c0e5299.tar.bz2 akono-da736d8259331a8ef13bf4bbb10bbb8a5c0e5299.zip |
remove node/v8 from source tree
Diffstat (limited to 'deps/node/benchmark/timers')
-rw-r--r-- | deps/node/benchmark/timers/immediate.js | 114 | ||||
-rw-r--r-- | deps/node/benchmark/timers/set-immediate-breadth-args.js | 27 | ||||
-rw-r--r-- | deps/node/benchmark/timers/set-immediate-breadth.js | 20 | ||||
-rw-r--r-- | deps/node/benchmark/timers/set-immediate-depth-args.js | 46 | ||||
-rw-r--r-- | deps/node/benchmark/timers/timers-breadth.js | 19 | ||||
-rw-r--r-- | deps/node/benchmark/timers/timers-cancel-pooled.js | 31 | ||||
-rw-r--r-- | deps/node/benchmark/timers/timers-cancel-unpooled.js | 33 | ||||
-rw-r--r-- | deps/node/benchmark/timers/timers-depth.js | 19 | ||||
-rw-r--r-- | deps/node/benchmark/timers/timers-insert-pooled.js | 17 | ||||
-rw-r--r-- | deps/node/benchmark/timers/timers-insert-unpooled.js | 33 | ||||
-rw-r--r-- | deps/node/benchmark/timers/timers-timeout-nexttick.js | 36 | ||||
-rw-r--r-- | deps/node/benchmark/timers/timers-timeout-pooled.js | 34 | ||||
-rw-r--r-- | deps/node/benchmark/timers/timers-timeout-unpooled.js | 36 |
13 files changed, 0 insertions, 465 deletions
diff --git a/deps/node/benchmark/timers/immediate.js b/deps/node/benchmark/timers/immediate.js deleted file mode 100644 index ba50f961..00000000 --- a/deps/node/benchmark/timers/immediate.js +++ /dev/null @@ -1,114 +0,0 @@ -'use strict'; -const common = require('../common.js'); - -const bench = common.createBenchmark(main, { - n: [5e6], - type: ['depth', 'depth1', 'breadth', 'breadth1', 'breadth4', 'clear'] -}); - -function main({ n, type }) { - switch (type) { - case 'depth': - depth(n); - break; - case 'depth1': - depth1(n); - break; - case 'breadth': - breadth(n); - break; - case 'breadth1': - breadth1(n); - break; - case 'breadth4': - breadth4(n); - break; - case 'clear': - clear(n); - break; - } -} - -// setImmediate tail recursion, 0 arguments -function depth(N) { - var n = 0; - bench.start(); - setImmediate(cb); - function cb() { - n++; - if (n === N) - bench.end(n); - else - setImmediate(cb); - } -} - -// setImmediate tail recursion, 1 argument -function depth1(N) { - var n = 0; - bench.start(); - setImmediate(cb, 1); - function cb(a1) { - n++; - if (n === N) - bench.end(N); - else - setImmediate(cb, 1); - } -} - -// Concurrent setImmediate, 0 arguments -function breadth(N) { - var n = 0; - bench.start(); - function cb() { - n++; - if (n === N) - bench.end(N); - } - for (var i = 0; i < N; i++) { - setImmediate(cb); - } -} - -// Concurrent setImmediate, 1 argument -function breadth1(N) { - var n = 0; - bench.start(); - function cb(a1) { - n++; - if (n === N) - bench.end(n); - } - for (var i = 0; i < N; i++) { - setImmediate(cb, 1); - } -} - -// Concurrent setImmediate, 4 arguments -function breadth4(N) { - N /= 2; - var n = 0; - bench.start(); - function cb(a1, a2, a3, a4) { - n++; - if (n === N) - bench.end(n); - } - for (var i = 0; i < N; i++) { - setImmediate(cb, 1, 2, 3, 4); - } -} - -function clear(N) { - N *= 4; - bench.start(); - function cb(a1) { - if (a1 === 2) - bench.end(N); - } - for (var i = 0; i < N; i++) { - clearImmediate(setImmediate(cb, 1)); - } - setImmediate(cb, 2); -} diff --git a/deps/node/benchmark/timers/set-immediate-breadth-args.js b/deps/node/benchmark/timers/set-immediate-breadth-args.js deleted file mode 100644 index 518ed90e..00000000 --- a/deps/node/benchmark/timers/set-immediate-breadth-args.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -const common = require('../common.js'); -const bench = common.createBenchmark(main, { - n: [5e6] -}); - -function main({ n }) { - - process.on('exit', () => { - bench.end(n); - }); - - function cb1(arg1) {} - function cb2(arg1, arg2) {} - function cb3(arg1, arg2, arg3) {} - - bench.start(); - for (let i = 0; i < n; i++) { - if (i % 3 === 0) - setImmediate(cb3, 512, true, null, 512, true, null); - else if (i % 2 === 0) - setImmediate(cb2, false, 5.1, 512); - else - setImmediate(cb1, 0); - } -} diff --git a/deps/node/benchmark/timers/set-immediate-breadth.js b/deps/node/benchmark/timers/set-immediate-breadth.js deleted file mode 100644 index 87bf9ee2..00000000 --- a/deps/node/benchmark/timers/set-immediate-breadth.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -const common = require('../common.js'); -const bench = common.createBenchmark(main, { - n: [1e7] -}); - -function main({ n }) { - - process.on('exit', () => { - bench.end(n); - }); - - function cb() {} - - bench.start(); - for (let i = 0; i < n; i++) { - setImmediate(cb); - } -} diff --git a/deps/node/benchmark/timers/set-immediate-depth-args.js b/deps/node/benchmark/timers/set-immediate-depth-args.js deleted file mode 100644 index d8eb5c40..00000000 --- a/deps/node/benchmark/timers/set-immediate-depth-args.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -const common = require('../common.js'); -const bench = common.createBenchmark(main, { - n: [5e6] -}); - -function main({ n }) { - - process.on('exit', () => { - bench.end(n); - }); - - function cb3(n, arg2, arg3) { - if (--n) { - if (n % 3 === 0) - setImmediate(cb3, n, true, null, 5.1, null, true); - else if (n % 2 === 0) - setImmediate(cb2, n, 5.1, true); - else - setImmediate(cb1, n); - } - } - function cb2(n, arg2) { - if (--n) { - if (n % 3 === 0) - setImmediate(cb3, n, true, null, 5.1, null, true); - else if (n % 2 === 0) - setImmediate(cb2, n, 5.1, true); - else - setImmediate(cb1, n); - } - } - function cb1(n) { - if (--n) { - if (n % 3 === 0) - setImmediate(cb3, n, true, null, 5.1, null, true); - else if (n % 2 === 0) - setImmediate(cb2, n, 5.1, true); - else - setImmediate(cb1, n); - } - } - bench.start(); - setImmediate(cb1, n); -} diff --git a/deps/node/benchmark/timers/timers-breadth.js b/deps/node/benchmark/timers/timers-breadth.js deleted file mode 100644 index 8cd77f4f..00000000 --- a/deps/node/benchmark/timers/timers-breadth.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; -const common = require('../common.js'); - -const bench = common.createBenchmark(main, { - n: [5e6], -}); - -function main({ n }) { - var j = 0; - bench.start(); - function cb() { - j++; - if (j === n) - bench.end(n); - } - for (var i = 0; i < n; i++) { - setTimeout(cb, 1); - } -} diff --git a/deps/node/benchmark/timers/timers-cancel-pooled.js b/deps/node/benchmark/timers/timers-cancel-pooled.js deleted file mode 100644 index 6f16f3c9..00000000 --- a/deps/node/benchmark/timers/timers-cancel-pooled.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; -const common = require('../common.js'); -const assert = require('assert'); - -const bench = common.createBenchmark(main, { - n: [5e6], -}); - -function main({ n }) { - - var timer = setTimeout(() => {}, 1); - for (var i = 0; i < n; i++) { - setTimeout(cb, 1); - } - var next = timer._idlePrev; - clearTimeout(timer); - - bench.start(); - - for (var j = 0; j < n; j++) { - timer = next; - next = timer._idlePrev; - clearTimeout(timer); - } - - bench.end(n); -} - -function cb() { - assert.fail('Timer should not call callback'); -} diff --git a/deps/node/benchmark/timers/timers-cancel-unpooled.js b/deps/node/benchmark/timers/timers-cancel-unpooled.js deleted file mode 100644 index 1daf68bd..00000000 --- a/deps/node/benchmark/timers/timers-cancel-unpooled.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; -const common = require('../common.js'); -const assert = require('assert'); - -const bench = common.createBenchmark(main, { - n: [1e6], - direction: ['start', 'end'] -}); - -function main({ n, direction }) { - - const timersList = []; - for (var i = 0; i < n; i++) { - timersList.push(setTimeout(cb, i + 1)); - } - - var j; - bench.start(); - if (direction === 'start') { - for (j = 0; j < n; j++) { - clearTimeout(timersList[j]); - } - } else { - for (j = n - 1; j >= 0; j--) { - clearTimeout(timersList[j]); - } - } - bench.end(n); -} - -function cb() { - assert.fail(`Timer ${this._idleTimeout} should not call callback`); -} diff --git a/deps/node/benchmark/timers/timers-depth.js b/deps/node/benchmark/timers/timers-depth.js deleted file mode 100644 index bfc6dd02..00000000 --- a/deps/node/benchmark/timers/timers-depth.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; -const common = require('../common.js'); - -const bench = common.createBenchmark(main, { - n: [1e3], -}); - -function main({ n }) { - var i = 0; - bench.start(); - setTimeout(cb, 1); - function cb() { - i++; - if (i === n) - bench.end(n); - else - setTimeout(cb, 1); - } -} diff --git a/deps/node/benchmark/timers/timers-insert-pooled.js b/deps/node/benchmark/timers/timers-insert-pooled.js deleted file mode 100644 index a7441a9e..00000000 --- a/deps/node/benchmark/timers/timers-insert-pooled.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; -const common = require('../common.js'); - -const bench = common.createBenchmark(main, { - n: [5e6], -}); - -function main({ n }) { - - bench.start(); - - for (var i = 0; i < n; i++) { - setTimeout(() => {}, 1); - } - - bench.end(n); -} diff --git a/deps/node/benchmark/timers/timers-insert-unpooled.js b/deps/node/benchmark/timers/timers-insert-unpooled.js deleted file mode 100644 index 232cc7c3..00000000 --- a/deps/node/benchmark/timers/timers-insert-unpooled.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; -const common = require('../common.js'); -const assert = require('assert'); - -const bench = common.createBenchmark(main, { - n: [1e6], - direction: ['start', 'end'] -}); - -function main({ direction, n }) { - const timersList = []; - - var i; - bench.start(); - if (direction === 'start') { - for (i = 1; i <= n; i++) { - timersList.push(setTimeout(cb, i)); - } - } else { - for (i = n; i > 0; i--) { - timersList.push(setTimeout(cb, i)); - } - } - bench.end(n); - - for (var j = 0; j < n; j++) { - clearTimeout(timersList[j]); - } -} - -function cb() { - assert.fail(`Timer ${this._idleTimeout} should not call callback`); -} diff --git a/deps/node/benchmark/timers/timers-timeout-nexttick.js b/deps/node/benchmark/timers/timers-timeout-nexttick.js deleted file mode 100644 index 781e505a..00000000 --- a/deps/node/benchmark/timers/timers-timeout-nexttick.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict'; -const common = require('../common.js'); - -// The following benchmark measures setting up n * 1e6 timeouts, -// as well as scheduling a next tick from each timeout. Those -// then get executed on the next uv tick. - -const bench = common.createBenchmark(main, { - n: [5e4, 5e6], -}); - -function main({ n }) { - let count = 0; - - // Function tracking on the hidden class in V8 can cause misleading - // results in this benchmark if only a single function is used — - // alternate between two functions for a fairer benchmark. - - function cb() { - process.nextTick(counter); - } - function cb2() { - process.nextTick(counter); - } - function counter() { - count++; - if (count === n) - bench.end(n); - } - - for (var i = 0; i < n; i++) { - setTimeout(i % 2 ? cb : cb2, 1); - } - - bench.start(); -} diff --git a/deps/node/benchmark/timers/timers-timeout-pooled.js b/deps/node/benchmark/timers/timers-timeout-pooled.js deleted file mode 100644 index d34080fa..00000000 --- a/deps/node/benchmark/timers/timers-timeout-pooled.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; -const common = require('../common.js'); - -// The following benchmark measures setting up n * 1e6 timeouts, -// which then get executed on the next uv tick - -const bench = common.createBenchmark(main, { - n: [1e7], -}); - -function main({ n }) { - let count = 0; - - // Function tracking on the hidden class in V8 can cause misleading - // results in this benchmark if only a single function is used — - // alternate between two functions for a fairer benchmark - - function cb() { - count++; - if (count === n) - bench.end(n); - } - function cb2() { - count++; - if (count === n) - bench.end(n); - } - - for (var i = 0; i < n; i++) { - setTimeout(i % 2 ? cb : cb2, 1); - } - - bench.start(); -} diff --git a/deps/node/benchmark/timers/timers-timeout-unpooled.js b/deps/node/benchmark/timers/timers-timeout-unpooled.js deleted file mode 100644 index 19f0f6a4..00000000 --- a/deps/node/benchmark/timers/timers-timeout-unpooled.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict'; -const common = require('../common.js'); - -// The following benchmark sets up n * 1e6 unpooled timeouts, -// then measures their execution on the next uv tick - -const bench = common.createBenchmark(main, { - n: [1e6], -}); - -function main({ n }) { - let count = 0; - - // Function tracking on the hidden class in V8 can cause misleading - // results in this benchmark if only a single function is used — - // alternate between two functions for a fairer benchmark - - function cb() { - count++; - if (count === n) - bench.end(n); - } - function cb2() { - count++; - if (count === n) - bench.end(n); - } - - for (var i = 0; i < n; i++) { - // unref().ref() will cause each of these timers to - // allocate their own handle - setTimeout(i % 2 ? cb : cb2, 1).unref().ref(); - } - - bench.start(); -} |