| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8ee30ea commit 278c990
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,14 +3,21 @@ | |||
| 3 | 3 | const common = require('../common.js'); | |
| 4 | 4 | const { randomBytes } = require('crypto'); | |
| 5 | 5 | ||
| 6 | + // Add together with imports | ||
| 7 | + const assert = require('assert'); | ||
| 8 | + | ||
| 9 | + let _cryptoResult; | ||
| 10 | + | ||
| 6 | 11 | const bench = common.createBenchmark(main, { | |
| 7 | - size: [64, 1024, 8192, 512 * 1024], | ||
| 8 | - n: [1e3], | ||
| 12 | + size: [64, 1024, 8 * 1024, 16 * 1024], | ||
| 13 | + n: [1e5], | ||
| 9 | 14 | }); | |
| 10 | 15 | ||
| 11 | 16 | function main({ n, size }) { | |
| 12 | 17 | bench.start(); | |
| 13 | 18 | for (let i = 0; i < n; ++i) | |
| 14 | - randomBytes(size); | ||
| 19 | + _cryptoResult = randomBytes(size); | ||
| 15 | 20 | bench.end(n); | |
| 21 | + // Avoid V8 deadcode (elimination) | ||
| 22 | + assert.ok(_cryptoResult); | ||
| 16 | 23 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments