| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 55838e7 commit 5457c7a
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,11 +1,12 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | const common = require('../common.js'); | |
| 3 | 3 | const StringDecoder = require('string_decoder').StringDecoder; | |
| 4 | + const assert = require('node:assert'); | ||
| 4 | 5 | ||
| 5 | 6 | const bench = common.createBenchmark(main, { | |
| 6 | 7 | encoding: ['ascii', 'utf8', 'base64-utf8', 'base64-ascii', 'utf16le'], | |
| 7 | - inLen: [32, 128, 1024, 4096], | ||
| 8 | - chunkLen: [16, 64, 256, 1024], | ||
| 8 | + inLen: [32, 128, 1024], | ||
| 9 | + chunkLen: [16, 256, 1024], | ||
| 9 | 10 | n: [25e5], | |
| 10 | 11 | }); | |
| 11 | 12 | ||
@@ -75,10 +76,13 @@ function main({ encoding, inLen, chunkLen, n }) { | |||
| 75 | 76 | ||
| 76 | 77 | const nChunks = chunks.length; | |
| 77 | 78 | ||
| 79 | + let avoidDeadCode; | ||
| 78 | 80 | bench.start(); | |
| 79 | 81 | for (let i = 0; i < n; ++i) { | |
| 82 | + avoidDeadCode = ''; | ||
| 80 | 83 | for (let j = 0; j < nChunks; ++j) | |
| 81 | - sd.write(chunks[j]); | ||
| 84 | + avoidDeadCode += sd.write(chunks[j]); | ||
| 82 | 85 | } | |
| 83 | 86 | bench.end(n); | |
| 87 | + assert.ok(avoidDeadCode); | ||
| 84 | 88 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments