0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-24 20:29:23 +01:00
nodejs/benchmark/buffers/buffer-btoa.js
Rafael Gonzaga ea5e77b1a5
benchmark: use assert.ok instead of assert
PR-URL: https://github.com/nodejs/node/pull/54176
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2024-08-04 13:29:34 +00:00

21 lines
397 B
JavaScript

'use strict';
const common = require('../common.js');
const assert = require('node:assert');
const bench = common.createBenchmark(main, {
size: [16, 32, 64, 128, 256, 1024],
n: [1e6],
});
function main({ n, size }) {
const input = 'A'.repeat(size);
let out = 0;
bench.start();
for (let i = 0; i < n; i++) {
out += btoa(input).length;
}
bench.end(n);
assert.ok(out > 0);
}