| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c570182 commit 6869846
10 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,32 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const v8 = require('v8'); | ||
| 5 | + const Readable = require('stream').Readable; | ||
| 6 | + | ||
| 7 | + const bench = common.createBenchmark(main, { | ||
| 8 | + n: [100e1] | ||
| 9 | + }); | ||
| 10 | + | ||
| 11 | + function main(conf) { | ||
| 12 | + const n = +conf.n; | ||
| 13 | + const b = new Buffer(32); | ||
| 14 | + const s = new Readable(); | ||
| 15 | + function noop() {} | ||
| 16 | + s._read = noop; | ||
| 17 | + | ||
| 18 | + // Force optimization before starting the benchmark | ||
| 19 | + s.push(b); | ||
| 20 | + v8.setFlagsFromString('--allow_natives_syntax'); | ||
| 21 | + eval('%OptimizeFunctionOnNextCall(s.read)'); | ||
| 22 | + s.push(b); | ||
| 23 | + while (s.read(128)); | ||
| 24 | + | ||
| 25 | + bench.start(); | ||
| 26 | + for (var k = 0; k < n; ++k) { | ||
| 27 | + for (var i = 0; i < 1e4; ++i) | ||
| 28 | + s.push(b); | ||
| 29 | + while (s.read(128)); | ||
| 30 | + } | ||
| 31 | + bench.end(n); | ||
| 32 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,32 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const v8 = require('v8'); | ||
| 5 | + const Readable = require('stream').Readable; | ||
| 6 | + | ||
| 7 | + const bench = common.createBenchmark(main, { | ||
| 8 | + n: [100e1] | ||
| 9 | + }); | ||
| 10 | + | ||
| 11 | + function main(conf) { | ||
| 12 | + const n = +conf.n; | ||
| 13 | + const b = new Buffer(32); | ||
| 14 | + const s = new Readable(); | ||
| 15 | + function noop() {} | ||
| 16 | + s._read = noop; | ||
| 17 | + | ||
| 18 | + // Force optimization before starting the benchmark | ||
| 19 | + s.push(b); | ||
| 20 | + v8.setFlagsFromString('--allow_natives_syntax'); | ||
| 21 | + eval('%OptimizeFunctionOnNextCall(s.read)'); | ||
| 22 | + s.push(b); | ||
| 23 | + while (s.read(106)); | ||
| 24 | + | ||
| 25 | + bench.start(); | ||
| 26 | + for (var k = 0; k < n; ++k) { | ||
| 27 | + for (var i = 0; i < 1e4; ++i) | ||
| 28 | + s.push(b); | ||
| 29 | + while (s.read(106)); | ||
| 30 | + } | ||
| 31 | + bench.end(n); | ||
| 32 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,33 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const v8 = require('v8'); | ||
| 5 | + const Readable = require('stream').Readable; | ||
| 6 | + | ||
| 7 | + const bench = common.createBenchmark(main, { | ||
| 8 | + n: [200e1] | ||
| 9 | + }); | ||
| 10 | + | ||
| 11 | + function main(conf) { | ||
| 12 | + const n = +conf.n; | ||
| 13 | + const b = new Buffer(32); | ||
| 14 | + const s = new Readable(); | ||
| 15 | + function noop() {} | ||
| 16 | + s._read = noop; | ||
| 17 | + | ||
| 18 | + // Force optimization before starting the benchmark | ||
| 19 | + s.push(b); | ||
| 20 | + v8.setFlagsFromString('--allow_natives_syntax'); | ||
| 21 | + eval('%OptimizeFunctionOnNextCall(s.push)'); | ||
| 22 | + eval('%OptimizeFunctionOnNextCall(s.read)'); | ||
| 23 | + s.push(b); | ||
| 24 | + while (s.read(32)); | ||
| 25 | + | ||
| 26 | + bench.start(); | ||
| 27 | + for (var k = 0; k < n; ++k) { | ||
| 28 | + for (var i = 0; i < 1e4; ++i) | ||
| 29 | + s.push(b); | ||
| 30 | + while (s.read(32)); | ||
| 31 | + } | ||
| 32 | + bench.end(n); | ||
| 33 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,32 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const v8 = require('v8'); | ||
| 5 | + const Readable = require('stream').Readable; | ||
| 6 | + | ||
| 7 | + const bench = common.createBenchmark(main, { | ||
| 8 | + n: [50e2] | ||
| 9 | + }); | ||
| 10 | + | ||
| 11 | + function main(conf) { | ||
| 12 | + const n = +conf.n; | ||
| 13 | + const b = new Buffer(32); | ||
| 14 | + const s = new Readable(); | ||
| 15 | + function noop() {} | ||
| 16 | + s._read = noop; | ||
| 17 | + | ||
| 18 | + // Force optimization before starting the benchmark | ||
| 19 | + s.push(b); | ||
| 20 | + v8.setFlagsFromString('--allow_natives_syntax'); | ||
| 21 | + eval('%OptimizeFunctionOnNextCall(s.read)'); | ||
| 22 | + s.push(b); | ||
| 23 | + while (s.read()); | ||
| 24 | + | ||
| 25 | + bench.start(); | ||
| 26 | + for (var k = 0; k < n; ++k) { | ||
| 27 | + for (var i = 0; i < 1e4; ++i) | ||
| 28 | + s.push(b); | ||
| 29 | + while (s.read()); | ||
| 30 | + } | ||
| 31 | + bench.end(n); | ||
| 32 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,32 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const v8 = require('v8'); | ||
| 5 | + const Readable = require('stream').Readable; | ||
| 6 | + | ||
| 7 | + const bench = common.createBenchmark(main, { | ||
| 8 | + n: [100e1] | ||
| 9 | + }); | ||
| 10 | + | ||
| 11 | + function main(conf) { | ||
| 12 | + const n = +conf.n; | ||
| 13 | + const b = new Buffer(32); | ||
| 14 | + const s = new Readable(); | ||
| 15 | + function noop() {} | ||
| 16 | + s._read = noop; | ||
| 17 | + | ||
| 18 | + // Force optimization before starting the benchmark | ||
| 19 | + s.push(b); | ||
| 20 | + v8.setFlagsFromString('--allow_natives_syntax'); | ||
| 21 | + eval('%OptimizeFunctionOnNextCall(s.read)'); | ||
| 22 | + s.push(b); | ||
| 23 | + while (s.read(12)); | ||
| 24 | + | ||
| 25 | + bench.start(); | ||
| 26 | + for (var k = 0; k < n; ++k) { | ||
| 27 | + for (var i = 0; i < 1e4; ++i) | ||
| 28 | + s.push(b); | ||
| 29 | + while (s.read(12)); | ||
| 30 | + } | ||
| 31 | + bench.end(n); | ||
| 32 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments