({ n, input, length })
| 12 | |
| 13 | |
| 14 | function main({ n, input, length }) { |
| 15 | const normalizedInput = length === 'short' ? input : input.repeat(300); |
| 16 | const encoder = new TextEncoder(); |
| 17 | const buff = encoder.encode(normalizedInput); |
| 18 | bench.start(); |
| 19 | for (let i = 0; i < n; ++i) { |
| 20 | assert.ok(buffer.isUtf8(buff)); |
| 21 | } |
| 22 | bench.end(n); |
| 23 | } |